nip.utils.maths.minstd_generate_pseudo_random_sequence#
- nip.utils.maths.minstd_generate_pseudo_random_sequence(seed: Int[Tensor, '...'], length: int) Int[Tensor, '... length'] [source]#
Generate a pseudo-random sequence of numbers using the MINSTD algorithm.
The MINSTD algorithm is a simple linear congruential generator (LCG) that is defined by the following recurrence relation:
\[x_{n+1} = (48271 * x_n) % 2147483647\]where \(x_0\) is the seed value.
- Parameters:
seed (Int[Tensor, ...]) – The seed value for the pseudo-random number generator. This is a tensor of arbitrary shape.
length (int) – The length of the pseudo-random sequence to generate.
- Returns:
pseudo_random_sequence (Int[Tensor, “… length”]) – The pseudo-random sequence of numbers \((x_1, \ldots, x_{\text{length}})\) generated using the MINSTD algorithm. An extra dimension is added to the output tensor to represent the sequence length.