Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-global rand.Rand and add -seed flag #204

Merged
merged 5 commits into from
Nov 5, 2021

Conversation

fxamacker
Copy link
Member

@fxamacker fxamacker commented Nov 4, 2021

Closes #21
Closes #104
Closes #189
Closes #203

Description

  • Use non-global rand.Rand for tests and benchmarks.

  • When -seed flag isn't specified, use time.Now().UnixNano() for seed non-global rand.Rand.

  • Use testing.T.Logf() to display the seed, which will only show up with -v flag or upon error. Otherwise, it won't be displayed.

  • Refactored and renamed bencharkmarks.

  • Reran CI on GitHub about 7-8 times without hitting the intermittent ~1 hour timeout issue.


  • Targeted PR against main branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

When -seed flag isn't specified, use time.Now().UnixNano().
Use testing.TB.Logf() to display the seed, which will only
show up with -v flag or upon error.
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to use a random generator per test 👍

@fxamacker fxamacker merged commit c84f5be into main Nov 5, 2021
@fxamacker fxamacker deleted the fxamacker/remove-default-rand-source branch November 5, 2021 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants