Maroonbells (talk | contribs) (add content for new identifier) |
|||
Line 1: | Line 1: | ||
− | {{mirc title|$ | + | {{mirc title|$rands identifier}}'''$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. |
== Synopsis == | == Synopsis == |
Latest revision as of 08:10, 26 July 2020
$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.
Synopsis[edit]
$rands(number1,number2)
$rands(char1,char2)
Parameters[edit]
number1,number2 = starting/ending range of integers
char1,char2 = starting/ending characters in range of characters. Valid range $chr(1) through $chr(65535)
Properties[edit]
None
Examples[edit]
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.
Compatibility[edit]
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.