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

Fix random seed and add 'seed' as parameter #105

Merged
merged 1 commit into from
Oct 19, 2018
Merged

Conversation

jdevost
Copy link
Contributor

@jdevost jdevost commented Oct 18, 2018

Description

I noticed the Random function wasn't working: It was random, but always in the same order.

We don't need to pass a Random object around, we simply need to set rand.Seed() once. Then all call to math/rand will be randomize.

It can be useful to set the seed directly to run the bot in a predictable fashion (ie. unit tests), so I added support for a -seed parameter.

@erocheleau
Copy link
Contributor

Did you test it? :D

@jdevost
Copy link
Contributor Author

jdevost commented Oct 19, 2018

Yes, I tested the -seed. It works as advertised.

@jdevost jdevost merged commit 0b5ce57 into master Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants