Deterministic random number generation in different systems

I need to send an identical sequence of random numbers to a distributed application network.

Since such a sequence can be quite long, I was thinking about sending only a (randomly generated) centralized seed initialization number and the length of the required sequence.

Given that each component of the recipient will use the same version of .NET, can this be a viable solution to get the same random data on all my nodes?

+7
source share
2 answers

You should be able to distribute the seed for Random (int seed) and recreate the same sequence, assuming you are using the same version of .NET in all environments.

System.Random @MSDN Notes

Notes to callers . The implementation of the random number generator in the Random class is not guaranteed to remain unchanged in all major versions of the .NET Framework. As a result, your application code should not assume that the same seed will result in the same pseudo-random sequence in different versions of the .NET Framework.

If you see a case when the wireframe version changes or you may need to recreate the old sequence after you start using the new version, you will want to create your own random implementation.

See answers to this question for pointers: Cross-platform random number generator

+9
source

You can use the Random class with a seed or use a service oriented architecture.

Random when initialized with a seed will produce an identical sequence.

+1
source

All Articles