Function Reference


SRandom

Set Seed for random number generation.

SRandom ( Seed )

Parameters

Seed Seed value for random number generation. Number between -2^31 and 2^31-1

Return Value

None.

Remarks

When using SRandom() sequence of random numbers will be repeated each time you run the script. For example, you can test the speed of the script and the random numbers will not affect the test results.
After each call to SRandom() random number generator starts a new sequence. Use the SRandom(@SEC), for random sequences.

Related

Random

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Sets the seed to the number 12.
        SRandom(12)

        ; Assign a Local variable the random number based on the above seed.
        Local $iRandom1 = Random()

        ; Note: You will get the same result each time as the seed is constant.

        ; Display the result.
        MsgBox($MB_SYSTEMMODAL, "", $iRandom1)
EndFunc   ;==>Example