Module random

Module random 

Source
Expand description

Pseudo-random number generation for internal use (Dropout, etc.)

Uses a simple Xorshift128+ algorithm for speed. Not cryptographically secure, but sufficient for ML randomness.

Functions§

bernoulli_mask
Generates a Bernoulli mask (1.0 with prob p, 0.0 with prob 1-p) In dropout terms: ‘p’ usually means “probability of zeroing out” (Torch convention) or “probability of keeping” (TensorFlow convention). PyTorch: p = prob of dropout (zeroing). Here we use p = prob of Dropout (Zeroing).
rand_uniform
Fills a buffer with random values from Uniform[0, 1)
seed
Seeds the thread-local RNG