KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can i generate a random number between A = 1 and B = 10 where each number has a different probability? Example: number / probability 1 - 20% 2 - 20% 3 - 10% 4 - 5% 5 - 5% ...and so on. I'm aware of some hard-coded workarounds which unfortunately are of no use with larger ranges, for example A = 1000 and B = 100000. Assume we have a Rand() method which returns a random number R, 0 < R < 1, can anyone post a code sample with a proper way of doing this ? prefferable in c# / java / actionscript.
Tags (comma-separated)
Save Edits
Cancel