- Home /
Are random numbers consistent across devices?
If I were to procedurally generate a level using random numbers and a fixed seed (i.e. the level generated with the seed of '1') would this produce the same results across different mobile devices? An example would be if I wanted to have a global high score for a given level. Presume I'm not a ding dong and I wrote the generation code so that the generation order is always the same and there aren't any race conditions to worry about.
The docs seem to indicate this is possible. I'd like to see someone who has actually done it comment before I commit to an answer.
Answer by kacyesp · Sep 01, 2014 at 06:54 AM
According to the answer on this post, it is not guaranteed: http://answers.unity3d.com/questions/393825/systemrandom-with-seed-not-matching-net-or-mono.html
If you want to guarantee the same results, you should write your own random number generator function.
Also, if Unity ever decides to change the implementation for its random number generator, you'd most likely get different results after the change.