uniform2_double#

nvmath.device.random.uniform2_double(state)#

使用指定的位生成器状态,从均匀分布中采样两个双精度浮点数。

参数:

state – 一个状态对象,对应于位生成器之一。

返回值:

类型为 nvmath.device.float64x2 的值。

示例

下面内核的 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.uniform2_double(states[i])