Rune.RngSourcePRNG key type representing the random state
Create a PRNG key from a seed value.
The seed is used to initialize the random state. Same seed produces same sequence of random numbers.
Split a PRNG key into multiple new keys.
split key n returns an array of n new independent keys derived from the input key. The original key should not be reused after splitting to maintain statistical guarantees.
Fold data into a key to derive a new key.
fold_in key data combines a key with integer data to produce a new key. Useful for deriving keys based on iteration indices or other structured data.
Convert key to integer representation for debugging.
to_int key returns the internal integer representation of the key. This is mainly useful for debugging and should not be used to recreate keys.
Generate uniform random values in [0, 1).
uniform key dtype shape generates a tensor of the given shape with values uniformly distributed in the half-open interval [0, 1).
Generate standard normal random values.
normal key dtype shape generates a tensor of the given shape with values sampled from a standard normal distribution (mean=0, std=1).
Generate random integers in a range.
randint key ~min ~max shape generates a tensor of integers uniformly distributed in the half-open interval [min, max).
Generate Bernoulli random values.
bernoulli key ~p shape generates a tensor of boolean values where each element is true with probability p.
Generate random permutation.
permutation key n generates a random permutation of integers from 0 to n-1.
Randomly shuffle the first dimension of a tensor.
shuffle key x returns a copy of tensor x with its first dimension randomly shuffled.
Sample from a categorical distribution.
categorical key logits ?axis samples indices from a categorical distribution defined by logits along the specified axis.