Random.kl¶
Functions¶
mathRandomInteger¶
Integer mathRandomInteger ( in Size seed, in Size index )
Generate an element of a sequence of uniformly-distributed random Integers between 0 and 2^29-1 (inclusive)
注釈
Each sequence is periodic with period length of 536,870,912. However, sequence seed + 1
overlaps with sequence seed
after 1,048,576 elements, so take care using different sequences.
seed | The sequence number |
index | The index within the sequence |
/*
** Example: mathRandomInteger
*/
require Math;
operator entry() {
// generate 10 random Integers from sequence 18
Integer values[10];
for (Index i = 0; i < 10; ++i)
values[i] = mathRandomInteger(18, i);
report(values);
}
/*
** Output:
[98566144,23143865,518408758,475343879,270115324,331920421,481032402,216647059,489620536,409517009]
*/
mathRandomFloat64¶
Float64 mathRandomFloat64 ( in Size seed, in Size index, in Float64 min, in Float64 max )
mathRandomFloat64¶
Float64 mathRandomFloat64 ( in Size seed, in Size index, in Float64 min, in Float64 max )
mathRandomFloat32¶
Float32 mathRandomFloat32 ( in Size seed, in Size index, in Float32 min, in Float32 max )
mathRandomFloat32¶
Float32 mathRandomFloat32 ( in Size seed, in Size index, in Float32 min, in Float32 max )
mathRandomScalar¶
Scalar mathRandomScalar ( in Size seed, in Size index )
An alias for mathRandomFloat32
mathRandomSInt32¶
SInt32 mathRandomSInt32 ( in Size seed, in Size index, in SInt32 min, in SInt32 max )
mathRandomUInt32¶
UInt32 mathRandomUInt32 ( in Size seed, in Size index, in UInt32 min, in UInt32 max )
mathRandomScalar¶
Scalar mathRandomScalar ( in Size seed, in Size index )
An alias for mathRandomFloat32
mathRandomIntegerArray¶
Integer[] mathRandomIntegerArray ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift )
mathRandomFloat64Array¶
Float64[] mathRandomFloat64Array ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift, in Scalar min, in Scalar max )
mathRandomFloat32Array¶
Float32[] mathRandomFloat32Array ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift, in Scalar min, in Scalar max )