From WikiChip
$rand identifier - mIRC
< mirc‎ | identifiers
Revision as of 14:22, 12 March 2019 by Maroonbells (talk | contribs) (add content for new identifier)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Synopsis

$rands(number1,number2)
$rands(char1,char2)

Parameters

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

Properties

None

Examples

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

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