Return a random number between 0 and 1.
XSharp.RT (in XSharp.RT.dll) Version: 2.18
Rand() allows you to generate pseudo-random numbers. Multiple calls to Rand() always return the same random number sequence, provided that they have the same start value (nSeed) on the first call and that any subsequent calls do not specify nSeed.
This example uses Rand() to generate the same sequence whenever it runs:
This example generates the same start value as the previous example but subsequent calls accept a seed value which is also influenced by the system time:
This example generates a sequence of random numbers and then reinitializes to the same seed to reproduce the same numbers:
This example multiplies the result by 100 to increase the range of returned values: