Samples from a normal distribution with mean \(\mu\) and standard deviation \(\sigma\) using the Box-Muller transform.
Arguments
- shape
(
integer())
Shape.- initial_state
(
tensorish)
RNG state (ui64[2]).- dtype
(
character(1)|stablehlo::TensorDataType)
Data type.- mu
(
tensorish)
Mean.- sigma
(
tensorish)
Standard deviation. Must be positive, otherwise results are invalid.
See also
Other rng:
nv_rbinom(),
nv_rdunif(),
nv_rng_state(),
nv_runif()
Examples
jit_eval({
state <- nv_rng_state(42L)
result <- nv_rnorm(c(2, 3), state)
result[[2]]
})
#> AnvilTensor
#> -0.0675 0.9489 1.9457
#> -0.5255 1.2002 0.0008
#> [ CPUf32{2,3} ]