rndExp#
Purpose#
Computes exponentially distributed random numbers with a choice of underlying random number generator.
Format#
- r = rndExp(rows, cols, scale)#
- { r, newstate } = rndExp(rows, cols, scale, state)
- Parameters:
rows (scalar) – number of rows of resulting matrix.
cols (scalar) – number of columns of resulting matrix.
scale (scalar or matrix) – scalar or matrix that is ExE conformable with the dimensions of the output. The scale parameter sometimes called \(\beta\)
state (scalar or opaque vector) –
Optional argument.
scalar case
state = starting seed value only. If -1, GAUSS computes the starting seed based on the system clock.
opaque vector case
state = the state vector returned from a previous call to one of the
rndrandom number functions.
- Returns:
r (rows x cols matrix) – exponentially distributed random numbers.
newstate (Opaque vector) – the updated state.
Remarks#
The properties of the pseudo-random numbers in x are specified in terms of the scale parameter sometimes called \(\beta\). This is the reciprocal of the rate parameter which is sometimes called \(\lambda\):
Examples#
// Set seed for repeatable output
rndseed 12345;
// Generate a 3x2 matrix of exponential
// random numbers with scale = 2
x = rndExp(3, 2, 2);
print x;
After the code above, x is:
0.19999741 1.6175607
0.54211710 4.0899319
1.3480216 5.5601364
See also
Functions rndCreateState(), rndStateSkip()