Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove dead code from Random #588
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rtfeldman
May 15, 2016
Member
Assuming this works, any reason not to do type Seed = Seed State and save a record?
|
Assuming this works, any reason not to do |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mgold
May 15, 2016
Contributor
As mentioned above, none except being minimally invasive.
Evan has expressed interest in replacing the RNG with PCG so in that larger PR I can be more assertive.
|
As mentioned above, none except being minimally invasive. Evan has expressed interest in replacing the RNG with PCG so in that larger PR I can be more assertive. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Gotcha. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
May 20, 2016
Member
Can you link to the implementation of the alternate approach that is "more random"?
|
Can you link to the implementation of the alternate approach that is "more random"? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mgold
May 20, 2016
Contributor
type Int64
= Int64 Int Int
type Seed
= Seed Int64 Int64Then this code. Also, these 64-bit arithmetic helpers.
If you're not planning to allow splittable seeds, you can eliminate one Int64 from the seed and make it a private constant. But I strongly suggest you include independent seeds because they're quite useful (for the multithreaded tests runner Richard is writing among other things). Also, although one frequently talks about splitting seeds themselves, I've found the generator of a seed to be a better abstraction. Trust me, I've spent a lot of time thinking about this so you don't have to :)
type Int64
= Int64 Int Int
type Seed
= Seed Int64 Int64Then this code. Also, these 64-bit arithmetic helpers. If you're not planning to allow splittable seeds, you can eliminate one |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mgold
May 20, 2016
Contributor
That (about independent seeds) being said, it's possible to incorporate the better RNG now and add independent seeds later. Don't let that prevent you from adding the RNG to a patch release.
|
That (about independent seeds) being said, it's possible to incorporate the better RNG now and add independent seeds later. Don't let that prevent you from adding the RNG to a patch release. |
mgold commentedMay 4, 2016
•
edited
Edited 1 time
-
mgold
edited May 4, 2016 (most recent)
Previously, seeds carried around two unused functions
splitandrange. Every seed carried around the samenextfunction. By removing these, we slightly decrease the memory footprint of aSeedand reduce the runtime size by, I haven't measured, but a few hundred bytes.You could go further by placing the
Statedirectly in theSeedvalue constructor without the use of a record, but I'm trying to be minimally invasive.