golearn icon indicating copy to clipboard operation
golearn copied to clipboard

Randomness Algorithms

Open hpxro7 opened this issue 11 years ago • 2 comments

Just wanted to bring up one minor bug and the ask about unseeded random number generation in Go.

There was a minor implementation bug in base/instances.go in regards to the Shuffle method on Instances that causes it to create a non-uniform distribution of shuffle permutations. I'll have it fixed with the correct Fisher-Yates algorithm and submit a pull request soon.

Another thing that came to my attention is that our libraries do not seed the math/rand generators. I'm not sure if this lack of seeding was a desired feature. As Go's rand package uses a fixed seed, behavior between runs is currently deterministic. Perhaps we could make it a convention to seed in our packages' init() function?

hpxro7 avatar Jun 06 '14 05:06 hpxro7

MATLAB certainly doesn't seed its random number generators...

Sentimentron avatar Jun 08 '14 20:06 Sentimentron

I'm still open to random seeding, but the issue is 1) finding a seed source that's genuinely random and 2) once you've found a random seed source, why not use it for all your randomness?

Sentimentron avatar Aug 03 '14 22:08 Sentimentron