Generates pseudo-random numbers using the specified algorithm and returns
the updated RNG state together with the generated values.
Usage
prim_rng_bit_generator(
initial_state,
rng_algorithm = "THREE_FRY",
dtype,
shape
)
Arguments
- initial_state
(arrayish)
RNG state (ui64[2]).
- rng_algorithm
(character(1))
RNG algorithm name. Default is "THREE_FRY".
- dtype
(character(1) | DataType)
Data type of the generated random values.
- shape
(integer())
Shape.
Value
list of two arrayish values:
The first element is the updated RNG state with the same dtype and shape
as initial_state. The second element is an array of random values with
the given dtype and shape.
Examples
state <- nv_array(c(0L, 0L), dtype = "ui64")
prim_rng_bit_generator(state, dtype = "f32", shape = c(3, 2))
#> [[1]]
#> AnvlArray
#> 0
#> 3
#> [ CPUui64{2} ]
#>
#> [[2]]
#> AnvlArray
#> 1.7973e+09 2.5791e+09
#> 1.3515e+09 3.2358e+09
#> 1.6886e+09 4.2293e+09
#> [ CPUf32{3,2} ]
#>