normal2#
-
nvmath.
device. normal2(state)#random. 使用指定的位生成器状态,从正态分布中采样两个浮点数。
- 参数:
state – 对应于其中一个位生成器的状态对象。
- 返回值:
类型为
nvmath.
的值。device. float32x2
示例
以下内核的
states
参数应为已初始化的位生成器状态数组。有关如何创建和初始化位生成器状态的更多详细信息,请参阅nvmath.
的文档。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.normal2(states[i])