Closed ramirez7 closed 10 months ago
This is because mkStdGen
precedes use of splitmix (since 1.2). But you can use generator from splitmix directly. And it exposes construction from Word64
Why not just expose the Word64 seeding function directly? ... If backwards compat is the issue, I suggest mkStdGenW64 :: Word64 -> StdGen (maybe I'll provide a PR myself?)
Yeah, we are not about to break compatibility of a function that is like 3 decades old. However, I do agree that providing mkStdGen64 :: Word64 -> StdGen
would be a good idea. It would be great if you could submit a PR? Side note, I don't think suffix W
is necessary)
I'd like to very explicitly provide 64 bits.
I am sure you know this, but just to make sure we are on the same page. By casting Int
to Word64
you are not loosing any bits, unless you are on a 32bit machine
Great to see this closed! Quality.
I want to deterministically seed with
mkStdGen
based on some unique bits I have (some UUID). I noticed thatmkStdGen
takeInt
and thenfromIntegral
s it to aWord64
, which splitmix actually uses.Why not just expose the
Word64
seeding function directly? I'd like to very explicitly provide 64 bits.For now, I can either just do my stuff in
Word32
/Word64
andfromIntegral
myself. Or I can do bit stuff and dosplit
binary search.If backwards compat is the issue, I suggest
mkStdGenW64 :: Word64 -> StdGen
(maybe I'll provide a PR myself?)