math/big: non-deterministic behaviour of big.Rand #42701
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
main.go
(edit: I added the wrong code first):output:
What did you expect to see?
I expected the
big.Rand
to perform deterministic amount of reads from the source, regardless of whether it was executed on a 32-bit or 64-bit platformWhat did you see instead?
That different amounts of read was performed.
In my case, this caused certain testcases to fail on 32-bit platforms, since although the exact random steps were unimportant, the differing amounts of reads caused the source to go "out of sync", thus turning what should have been a deterministic process into two different deterministic processes (one for 64-bit and one for 32-bit).
This seems wrong to me, but there are obviously ways to work around it, so can't really say it's a biggie. Maybe there are other projects bit by this in other ways though, so the behaviour should at least be documented.
The text was updated successfully, but these errors were encountered: