Lineargen
rand compatible bit sequence generators
based on Galois linear feedback shift registers.
Due to the compatibility with rand, various kinds of
number sequences can be generated. One can also choose
elements from slices or shuffle them using the generated
bit sequence from the LFSR.
Note that LFSRs are extremely fast and easy to implement, but their statistical properties might not always be the best and they are definitely not cryptographically secure.
Examples
Choose from elements in an array:
use SeedableRng; // 0.8.5
use SliceRandom;
use Linear128;
Generate a sequence of f32:
use *; // 0.8.5
use Linear64;
See how the LFSR actually works:
use SeedableRng; // 0.6.4
use Linear16;
Reference
The LFSR taps were taken from: https://www.physics.otago.ac.nz/reports/electronics/ETR2012-1.pdf.