Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deterministic random number generation across systems

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

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

Given that every component on the receiving hand will use the same .NET version, would that be a viable solution to have identical random data generated on all of my nodes?

like image 398
Andrea Avatar asked Jun 26 '13 11:06

Andrea


People also ask

What is deterministic random number generator?

A DRBG is often called a Pseudorandom Number (or Bit) Generator. Source(s): NIST SP 800-90B. A random bit generator that includes a DRBG algorithm and (at least initially) has access to a source of randomness. The DRBG produces a sequence of bits from a secret initial value called a seed.

Are random numbers deterministic?

Random bits are generated by running a deterministic random bit generator (DRBG) on the entropy pool data bits. This algorithm is deterministic (it always produces the same output given the same input).

What are different types of random number generator techniques?

There are generally two kinds of random number generators: non-deterministic random number generators, sometimes called "true random number generators" (TRNG), and deterministic random number generators, also called pseudorandom number generators (PRNG).

Are pseudorandom generators deterministic?

In theoretical computer science and cryptography, a pseudorandom generator (PRG) for a class of statistical tests is a deterministic procedure that maps a random seed to a longer pseudorandom string such that no statistical test in the class can distinguish between the output of the generator and the uniform ...


2 Answers

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

Remarks on System.Random @ MSDN

Notes to Callers The implementation of the random number generator in the Random class is not guaranteed to remain the same across 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 can see a case where the framework version will change, or if you may need to recreate an old sequence after you've started using a new version, you'll want to create your own random implementation.

See the answers of this question for pointers: Crossplatform random number generator

like image 103
drch Avatar answered Oct 10 '22 22:10

drch


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.

like image 33
Dustin Kingen Avatar answered Oct 10 '22 22:10

Dustin Kingen