Main Archive Specials Wiki | FAQ Links Submit Forum


PRNG for non-uniformly distributed values from trigonometric identity

Type : pseudo-random number generator
References : Posted by neolit123 gmail com

Notes :
a method, which generates random numbers in the [-1,+1] range, while having a probability density function with less concentration of values near zero for sin().
you can use an approximation of sin() and/or experiment with such an equation for different distributions. using tan() will accordingly invert the pdf graph i.e. more concentration near zero, but the output range will be also affected.

extended read on similar methods:
http://www.stat.wisc.edu/~larget/math496/random2.html

regards
lubomir


Code :
//init
x=y=1;

//sampleloop
y=sin((x+=1)*y);



Comments

There are no comments on this item

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!
Email:

Comment:

Are you human?



Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion