Generating Random Numbers in C#
suggest changeSyntax
- Random()
- Random(int Seed)
- int Next()
- int Next(int maxValue)
- int Next(int minValue, int maxValue)
Parameters
| Parameters | Details |
| ---------- | ------- |
| Seed | A value for generating random numbers. If not set, the default value is determined by the current system time.
| minValue | Generated numbers won't be smaller than this value. If not set, the default value is 0.
| maxValue | Generated numbers will be smaller than this value. If not set, the default value is `Int32.MaxValue`.
| return value | Returns a number with random value.## Remarks
The random seed generated by the system isn't the same in every different run.
Seeds generated in the same time might be the same.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents