Re: TIB: weighting dice


[Prev][Next][Index][Thread]

Re: TIB: weighting dice




Again, both formulas I suggested do not necessarily produce the desired 
result.  What I did in order to produce my method is to test it out as a 
function.  Since your dice will depend on the random number generator 
'rand()', a number that will always appear between 0 and 1, I recommend 
turning replacing rand with 'x' and graphing it.

Next set your window to be between x=0 and x=1. Graph your function. In 
your case you want the higher numbers to have a higher probability, and 
so you should use a function that grows quickly and slows that growth as 
x increases to 1. I (naturally) chose the natural logarithm ln().  
Unfortunately ln(x) is negative when x<1. So I added 1 to the x in the 
function to keep it nonnegative.

You could also try other stuff like sqrt(x), or x^(-3), or any other 
function that grows more slowly as x increases.  It's all just how much 
you want the curve to favor higher numbers and choosing a number that 
you prefer most.

Tavis

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: