如何在cuda中生成伪随机 [英] How to generate pseudo random in cuda
问题描述
我试图构建一个利用CUDA进行重型提升的粒子系统。我想随机化一些粒子的初始值,如速度和寿命。随机数不必是超随机的,因为它只是为了视觉效果。我发现这篇文章涉及相同的主题:
I am attempting to build a particle system utilizing CUDA to do the heavy lifting. I want to randomize some of the particles' initial values like velocity and life span. The random numbers don't have to be super random since it's just for visual effect. I found this post that addresses the same subject:
这表明线性同余是要走的路。它似乎应该很容易实现,但我无法获得任何有用的我的实现。
That suggests a linear congruential is the way to go. It seems like it should be simple to implement, but I am having trouble getting anything useful of my implementation. Can anyone provide some code that will run in the device?
我在Windows 7 64位上使用CUDA和VC ++。
I am using CUDA with VC++ on Windows 7 64bit.
推荐答案
包含在NVidia SDK中的CUDA伪随机数生成器是
CUDA pseudo random number generators are
<
C / src / MersenneTwister /
和 C / src / quasirandomGenerator
以单独的论文和来源提供:
available as separate papers and source:
2.a Langdon的论文和 Langdon的源代码
这篇关于如何在cuda中生成伪随机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!