Skip to contents

Samples from a uniform distribution in the open interval (lower, upper).

Usage

nv_runif(shape, initial_state, dtype = "f32", lower = 0, upper = 1)

Arguments

shape

(integer())
Shape.

initial_state

(arrayish)
RNG state (ui64[2]).

dtype

(character(1) | tengen::DataType)
Data type.

lower, upper

(numeric(1))
Lower and upper bound.

Value

(list() of arrayish)
List of two elements: the updated RNG state and the sampled values.

Examples

state <- nv_rng_state(42L)
result <- nv_runif(c(2, 3), state)
result[[2]]
#> AnvlArray
#>  0.8690 0.1506 0.5203
#>  0.3103 0.9928 0.1065
#> [ CPUf32{2,3} ]