Tag Archives: random numbers

Produce a repeatable series of “random” numbers in C#

The Random class can generate a series of pseudo-random numbers. They’re called “pseudo-random” rather than “random” because the numbers are generated by a mathematical algorithm rather than by some completely unpredictable process such as observing a source of radioactive decay … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , | Leave a comment

Make extension methods to generate random double values in C#

This example adds extension methods to the Random class to generate double values within a specified range. The Random class provides methods for generating pseudo-random numbers. The Next method has three overloaded versions that produce a non-negative integer, an integer … Continue reading

Posted in extension methods, mathematics | Tagged , , , , , , , , , , | 1 Comment

Use a cryptographic random number generator in C#

The Random class generates random numbers, but they aren’t cryptographically secure. What does “cryptographically secure” mean? It means that an attacker, after seeing a series of random numbers that you generate, cannot predict the next one with any success. This … Continue reading

Posted in algorithms, cryptography, mathematics | Tagged , , , , , , , , , , | 6 Comments