mardi 28 avril 2015

Weightened random number (without predefined values!)

currently I'm needing a function which gives a weightened, random number. It should chose a random number between two doubles/integers (for example 4 and 8) while the value in the middle (6) will occur on average, about twice as often than the limiter values 4 and 8. If this were only about integers, I could predefine the values with variables and custom probabilities, but I need the function to give a double with at least 2 digits (meaning thousands of different numbers)!

The environment I use, is the "Game Maker" which provides all sorts of basic random-generators, but not weightened ones.

Could anyone possibly lead my n the right direction how to achieve this?

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire