Advertisement

Weighted random number generation

Started by March 01, 2002 11:45 AM
1 comment, last by graeme 22 years, 11 months ago
I have been messing around a bit with sqrts and sins, in the hope of finding a simple algorithm which generates a random number which is weighted towards one of it''s magnitudes. ie a random number between 1 and 100 which is most likely to be a zero and least likely to be 100. I have had no luck. Any ideas?
Generate a floating point number between 0 and 10 and square it.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Edited by - Kylotan on March 1, 2002 2:24:50 PM
Advertisement
so simple it is beautiful
thanks

This topic is closed to new replies.

Advertisement