Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 13 Jul 12:04
5c58942

What's Changed

For tests that need to keep generating random test data, it is more efficient to continue using the same random source instead of creating a new one each time data is generated. This also applies to the generation logic itself when one part of the generation logic uses another.

This PR lets the caller create a pseudo-random number source that can be uses reused for generating test data. This is also use within the test logic itself to avoid creating unnecessary random sources.

Also included in this PR are new functions, Name and NameSize, that generate fixed-size and random-size random name strings, and StringToSeed and Uint64ToSeed to create seed values.

This PR fixes two minor defects in the random/files package. First, random-size names never reached the maximum size. Second, the file names were more likely to contain a "0" due to its inclusion twice in the alphabet used for file name generation. Also fixes is a minor defect with ensuring unique addresses.

Finally, this PR migrates from /math/rand/ to /math/rand/v2 and uses ChaCha8 as its random number source.

Summary of changes in this PR:

  • Enable reuse of pseudo-random source for data generation
  • Internal efficiency improvements due to reuse of random source
  • Fix error with ensuring unique addresses
  • Fix minor defects with random file name generation
  • Increases test coverage.
  • Adds two new APIs Name and NameSize, for generating fixes and random-sized random names.
  • No global seed or sequence.
  • Added StringToSeed and Uint64ToSeed to create seed values
  • Update CLI tools to take strings to create seed values
  • Move from /math/rand to /math/rand/v2`

The move to a different number generator, ChaCha8, means that different values will be generated than before, and tests depending on deterministic random values need to be updated.

⚠️ BREAKING API Changes

  • Seed value changed from uint64 to [32]byte as needed for ChaCha8
  • Do not support global seed
  • Do not support global sequence
  • Make Sequence a separate type
  • NewRand and NewSeededRand no longer create a *rand.Rand. This is only breaking in cases where *rand.Rand is expected. Expecting io.Reader will continue to work.
  • Bytes and BlocksOfSize now take an int64 as the size argument, which is more consistent with the golang standard library.
  • Deterministic random values output by API are different in this release.

Non-breaking API Changes

  • Added Name and NameSize functions to API
  • Added NewSeed function to create new seed of type [32]byte
  • Added StringToSeed and Uint64ToSeed to create [32]byte seed values
  • Deprecated NewRand and NewSeededRand

Full Changelog: v0.3.0...v0.4.0