I am trying to set up CI using Travis. But I'm running into tests failing on Travis but not locally, even providing the same seed.
I thought the seeds run the same but now I am unsure and would like to make it clear wether it does or not so I now where to look at.
Have a look at this RSpec feature page:
In Ruby, randomness is seeded by calling
srand
and passing it the seed that you want to use. By doing this, subsequent calls torand
,shuffle
,sample
, etc. will all be randomized the same way given the same seed is passed tosrand
.
So in short, yes, it will run in the same order on other machines.
Ruby's srand
does guarantee the same numbers across machines using the same Ruby version. See this SO question and resulting answers: Does seed generate same random sequence across different Rubys?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With