Grr... my reply just got eaten by the net-demon!
there are two ways to use the formula:
1) invert it and solve for x. There''s a sqrt in the answer. Sample uniformly from [0,1] and sub in for p(x) in the sqrt term. Check for non-negative sqrt argument. If positive, you get two values for x. Sample from [0,1] again split on 0.5. Take one value of x for <0.5, other value for higher or equal to.
2) Compute cumulative probability distibution of the above density function. This gives a mapping from [-infty,+infty] onto [0,1] that has Gaussian statistics. Implement it as a lookup table. Sample uniformly from [0,1] and return the value of x that matches it.
Sorry for the brevity... I really didn''t want to type out my long response again!
Cheers,
Timkin
BTW: The Box-Muller method if fairly straightforward. As for the code I mentioned, go here.
Randm Number Generation
quote:When that happens to me, I just press "refresh"...
Original post by Timkin
Grr... my reply just got eaten by the net-demon!
quote:
It results in solid, rectangular edges on the stream of particles because the vectors of all of the particles are evenly distributed to the defined limit
You''re not stuck to a box shaped origin for your particles
You may have :
a sphere (radius, rotate x, rotate y)
a disc (radius, rotate y)
a square (x, y)
etc...
----
David Sporn AKA Sporniket
----David Sporn AKA SporniketThe blog of the Sporniket(in French) | Sporniket-Studio.com, my gallery of poster (via zazzle.com) | Sanctuaire Tokugawa, free Japanese lesson (in French)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement