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

Re: Interesting problem

Hmm.... interesting problem.

Here's what I'm thinking.  Write a function that accepts one double
parameter in the range (0,1).  The result of this function should be
distributed the way you want them to be distributed and should average
4.2.  Pass the function a random number in the interval (0,1) and you've
got yourself a random result.

A couple good math textbooks might speed up your function.  If you want to
go simple, just make the function a collection of lines. (If the value is
< 0.2, use this line, if the value is less that 0.4, use this other line,
...).  See what I'm sayin'?


----- Ian Crawford - Email: icrawfor@uoguelph.ca ----------------
-------------------- URL: http://www.uoguelph.ca/~icrawfor/ -----
-------------------- ICQ: 9625112 -------------------------------