warp.poisson#
- warp.poisson(state: uint32, lam: float32) uint32#
Kernel
Python
Generate a random sample from a Poisson distribution.
In a kernel, advances
statein place whenlam > 0(and returns0without consuming RNG state whenlam == 0); called from the Python scope, it does not modifystate, so repeated calls with the samestatereturn the same count (seerand_init()). The returned count has mean and variance both equal tolam.@wp.kernel def counts(seed: int, rate: float, out: wp.array[wp.uint32]): i = wp.tid() rng = wp.rand_init(seed, i) out[i] = wp.poisson(rng, rate)
- Parameters:
state – RNG state; advanced in place when called in a kernel (see
rand_init()).lam – Expected value (rate) of the distribution; must be non-negative.
- Returns:
A
uint32sample drawn fromPoisson(lam).