How are random command line numbers generated?

There is a variable in the command line environment %random%that uses some algorithm to generate pseudo random numbers.

Does anyone know the algorithm that generates these numbers?

+4
source share
1 answer

The dynamic variable %random%generates a random number from 0 to 32,767 inclusive. The algorithm from which these numbers are generated is as follows:

srand((unsigned)time(NULL));

It turns out that the Windows shell uses a standard naive algorithm to seed a random number generator (Quote from here )

- .

, , , - .

+7

All Articles