Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to bias a random number generator

Tags:

c++

random

i am using the random number generator provided with stl c++. how do we bias it so that it produces smaller random numbers with a greater probability than larger random numbers.

like image 835
Rohit Banga Avatar asked Nov 17 '25 20:11

Rohit Banga


1 Answers

One simple way would be to take every random number generated in the range [0,1) and raise it to any power greater than 1, depending how skewed you want the results

like image 148
Gareth Avatar answered Nov 20 '25 09:11

Gareth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!