uniform#
-
nvmath.
device. random. uniform(state)# Sample a float from uniform distribution using the specified bit generator state.
- Parameters:
state – a state object corresponding to one of the bit generators.
- Returns:
A value of type
float32
.
Example
The
states
parameter of the kernel below should be an array of already initialized bit generator states. See the documentation ofnvmath.
for more details on how to create and initialize the bit generator states.device. random. init() >>> from numba import cuda >>> from nvmath.device import random >>> compiled_apis = random.Compile() >>> @cuda.jit(link=compiled_apis.files, extensions=compiled_apis.extension) ... def kernel(states): ... i = cuda.grid(1) ... value = random.uniform(states[i])