Go has two packages for random numbers:
crypto/rand, which provides a way to get random bytesmath/rand, which has a nice algorithm for shuffling ints
Since they are both part of the same standard library there should be a way to combine them in a way so that crypto/rand provides a good source of random numbers that is used by math/rand.Perm to generate a permutation.
I hope it is not necessary that I (as a user of the standard library) have to write the boilerplate code to wrap the crypto/rand/Reader into a math/random/Source interface. Or do I have to?
Aucun commentaire:
Enregistrer un commentaire