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?
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.
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).
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).
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 ...
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
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.
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