Add functionality for generating a ByteArray#10
Add functionality for generating a ByteArray#10lehins merged 6 commits intointerface-to-performancefrom
Conversation
System/Random.hs
Outdated
| -- in order not to mess up the byte order we write generated Word64 into a temporary | ||
| -- pointer and then copy only the missing bytes over to the array |
There was a problem hiding this comment.
A previous iteration of this code used uniformWord8 to generate those remaining bytes. Did you replace the uniformWord8 based generation for the remaining bytes by uniformWord64 based generation because of byte order?
If that is the case, I think this comment could be even more explicit: "... we write generated Word64 instead of generating Word8 one by one ..." or something like that.
There was a problem hiding this comment.
It was not only byte order. Generating 1xWord64 and 8x Word8 concatenated together will always give you different result, because in order generate 8x Word8 we need to generate 8x Word64 first (at least in case of splitmix)
I'll add a more descriptive comment to the function
|
I also added helper functions for generating ByteString, which I am sure will come in handy. |
Add functionality for generating a ByteArray
Here is an interface and default implementation for generating a sequence of bytes as a
ByteArrayI mentioned this briefly in #5 (comment)