Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Restore a random seed when the Generator is destroyed #1534

Merged
merged 1 commit into from
Nov 20, 2018

Conversation

lyrixx
Copy link
Contributor

@lyrixx lyrixx commented Jul 26, 2018

Without this patch, the mt_rand seed could stay at the very same
value, and so break all other usages to mt_rand.


Oh, We had really hard time to find this bug :)
We are using Faker in our test suite, and we get a really strange
behavior : some entity were generated with the exact same UUID.
ATM, our implement of UUID generation is based on mt_rand.
Anyway, we found that Faker modifies the seed and let it to the same
value. So with this patch, we restore the seed to a random value.
And eveything goes fine now.

Without this patch, the `mt_rand` seed could stay at the very same
values, and so break all other usage to `mt_rand`.
@lyrixx lyrixx closed this Jul 26, 2018
@lyrixx lyrixx deleted the fix-mt_srand branch July 26, 2018 16:11
@lyrixx lyrixx restored the fix-mt_srand branch July 26, 2018 16:11
@lyrixx lyrixx reopened this Jul 26, 2018
@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2018

ping @fzaninotto (this is an easy pick)

@fzaninotto fzaninotto merged commit bd481c8 into fzaninotto:master Nov 20, 2018
@fzaninotto
Copy link
Owner

Thanks!

@lyrixx lyrixx deleted the fix-mt_srand branch November 20, 2018 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants