10.6 Pseudorandom Number Generators

For most of the probability functions, there is a matching pseudorandom number generator (PRNG) with the suffix _rng. For example, the function normal_rng(real, real) accepts two real arguments, an unconstrained location \(\mu\) and positive scale \(\sigma > 0\), and returns an unconstrained pseudorandom value drawn from \(\text{Normal}(\mu,\sigma)\). There are also vectorized forms of random number generators which return more than one random variate at a time.

10.6.1 Restricted to Transformed Data and Generated Quantities

Unlike regular functions, the PRNG functions may only be used in the transformed data or generated quantities block.

10.6.2 Limited Vectorization

Unlike the probability functions, only some of the PRNG functions are vectorized.