pcg
pcg
pcg
pcg-view
pcg-decide
7.7

pcg

kefin

 (require pcg) package: pcg

Permuted congruential generators (PCG) are a class of pseudo-random number generators (PRNGs) that provide high statistical quality whilst being fast, simple, and memory-efficient.

> (require pcg)
> (define state (pcg 3912))
> (pcg-view state)

946363416

procedure

(pcg state)  natural?

  state : natural?
Advances the state by 1 iteration. Note that you should not use the return value directly in your program, instead, one must filter this value through pcg-view in order to get the statistical properties associated with PCG, otherwise the randomness is in accordance with an linear congruential generator (LCG).

This step uses the 64-bit LCG.

procedure

(pcg-view state)  natural?

  state : natural?
Transform the state into its view. The view is PCG-XSG-RR.

procedure

(pcg-decide state)  bool?

  state : natural?
Transform the state into a boolean value. Uses pcg-view and masks all but one bit.

> (require pcg)
> (define state (pcg 3912))
> (pcg-decide state)

#f