View Single Post
  #5  
Old 09-01-2013, 03:03 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
wow i'm bad with statistics. apparently you can transform your rand()'s uniform distribution into a desired distribution via the latter's quantile function which is the inverse of the cumulative distribution function which is the integral of the probability density function and you could pick something like 2*(1-x) as your density function (for 0<=x<1, i guess the idea is that it's normalized). then wolfram alpha gives 1-sqrt(1-x) (the + solution sounds useless i dunno). so you'd transform the uniform 0<=x<1 rand() into a number between 0 and 10 by doing (1-sqrt(1-rand()))*11 and rounding down.

i guess if 1-x doesn't appeal to you as a distribution you can do the whole thing with stuff like 1-sqrt(x) and 1-x*x and that sort of thing and see if something cool happens but wow i hate statistics.
Reply With Quote