本文介绍了如何在cuda中生成伪随机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图构建一个利用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: CUDA中的随机数生成这表明线性同余是要走的路。它似乎应该很容易实现,但我无法获得任何有用的我的实现。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的源代码 2.b Mersenne Twister on GPU 这篇关于如何在cuda中生成伪随机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!