Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi: repo-wide bandaid for rand.Seed abuses
Early on we got in the habit of building tests on data with reproducible random sequences using the math/rand package's global *math.Rand instance, seeding it with some arbitrary hard coded numbers to get certain sequence. That proved quite problematic for test maintenance, concurrency, and now the standard library rightly has deprecated the use of rand.Seed and they have made the default initialization actually random instead of with "1" as the seed. > The math/rand package now automatically seeds the global random number > generator (used by top-level functions like Float64 and Int) with a > random value, and the top-level Seed function has been deprecated. > Programs that need a reproducible sequence of random numbers should > prefer to allocate their own random source, using > rand.New(rand.NewSource(seed)). > > Programs that need the earlier consistent global seeding behavior can > set GODEBUG=randautoseed=0 in their environment. > > The top-level Read function has been deprecated. In almost all cases, > crypto/rand.Read is more appropriate. This commit is a bandaid to get the test passing given the new random seeding of the package level math/rand.Rand. We should look at rewriting some of these tests to not have unrecorded but expected magic values to produce certain test data set.
- Loading branch information
Showing
10 changed files
with
94 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.