initurn
initurn(
@size 10
@id 0
@useseed 0
) -> null
Initializes a new unique random number generator (URN), given a size and a URN identifier. Once initialized, the identifier can be used to generate unique random numbers with the urn
function. This allows for independent URNs of different sizes to be used within the same script. If a URN associated with the identifier already exists, the URN is reset. The initialized URN can be optionally be seed-based. See setseed
.
Arguments
@size
[int]: number of unique random numbers. (default:10
).@id
[int/float/symbol]: identifier for unique random number generator. (default:0
).@useseed
[list/llll]: use random seed for URN associated with@id
. (default:0
).
Usage
initurn(@size 3 @id 'myurn'); ## initialize URN
for $i in 1...30 do print(urn(@id 'myurn')) ## call URN