There are many different ways to generate random numbers on a computer, most random number generators use the linear congruential relationship. This congruential generator produces a sequence of integers x1, x2, x3, ... between 0 and m1:Ri=xim   (i=1,2,3,...)

The initial value \dpi{100} \fn_jvn x_0 is the seed, \dpi{100} \fn_jvn a is the constant multiplier, \dpi{100} \fn_jvn c is the increment, and \dpi{100} \fn_jvn m is the modulus. The value value of \dpi{100} \fn_jvn x_{i+1} equals the reminder from the divison of \dpi{100} \fn_jvn ax_i+c by \dpi{100} \fn_jvn m. The random number between 0 and 1 is then generated using the equation:

\dpi{100} \fn_jvn R_i = \frac{x_i}{m}\; \; \; \; (i = 1,2,3,...)

We use the class ‘Random’ in .NET Core, which used the system clock as seed:

– Random floating-point number that is greater than or equal to 0.0, and less than 1.0:

static Random randomX = new Random();
decimal rnX = Convert.ToDecimal(randomX.NextDouble());

– Random number number that is greater than or equal to x, and less than y:

static Random randomX = new Random();
decimal rnX = Convert.ToDecimal(randomX.Next(x, y));

The probability factor

Suppose it is required to generate random numbers using a probability component