From WikiChip
$rands identifier - mIRC
< mirc‎ | identifiers

$rands returns a "cryptographically secure" random integer from the specified range, using the Microsoft's RtlGenRandom() and SystemFunction036() API. Syntax is exactly the same as for $rand except for the source being different.




number1,number2 = starting/ending range of integers
char1,char2 = starting/ending characters in range of characters. Valid range $chr(1) through $chr(65535)




See $rand for examples, as this identifier differs only in the source of the random values.

//var %i 999999 , %t $ticks | while (%i) { noop | dec %i } | echo -a ms: $calc($ticks - %t)
//var %i 999999 , %t $ticks | while (%i) { noop $rand(0,999999999) | dec %i } | echo -a ms: $calc($ticks - %t)
//var %i 999999 , %t $ticks | while (%i) { noop $rands(0,999999999) | dec %i } | echo -a ms: $calc($ticks - %t)

This shows that only 1/3rd of the time is due to $rand, and the other 2/3rds is the scripting overhead. For the remaining time used by the $rand function, it appears that $rands is around 25% slower than $rand.


Added: mIRC v7.55
Added on: 08 Feb 2019
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.

See also