Archive for random number

GPU uniform random noise via MD5 hash

Posted in programming, project zombie with tags , , , on October 1, 2008 by bey0ndy0nder

EDITED:

You can find the an implementation here. Note that to speed it up you want to unroll the loops, which I have already done. I may post the unrolled version. If you need that just leave a comment.

Project Zombie requires random numbers (geez, I’m sorry to abuse the language ;) ) in order to properly simulate certain aspect of GPU based zombies. I have been looking at RNG on the GPU. Initially, I will implement a uniform random noise generator via MD5 hash detailed in Parallel white noise generation on a GPU via cryptographic hash. Check out the wiki page on MD5 hash: md5

Some examples where I can use this random noise function is for example, I may want my zombie to randomly wander. So, at time t, I generate 2 random numbers (which would work perfectly with this md5 hash since the digest from that function is 128 bit, or 4 32 bit ints), x1, x2, so if x2 is greater than x1, then we pick a new random direction to traverse.

Another problem is the above GPU MD5 will only work for G80 generation and above GPUs (integer data type support). So, I may have to fall back on implementing a parallelized congruent based RNG method for older cards, but since project zombie is really intended for those with an current gen. GPU, it’s definitely not going to be a top priority.