Suppose I have an array of 8 numbers x(1)=.15, x(2)=.50, x(3)=.02 etc. where x(1) + x(2) + x(3) ... x(8) = 100%
I want to write a subroutine that generates random numbers 1-8 where the chance of a 1 is 15%, the chance of a 2 is 50%, the chance of a 3 is 2%, etc. - according to the percentages in my table.
I just want an idea how to do it, not the actual code.... thanx!
2007-10-24
02:30:13
·
1 answers
·
asked by
I'm an Atheist
3
in
Computers & Internet
➔ Programming & Design
That's right... it's a version of the Monte Carlo method.... THANK YOU!
2007-10-24
04:19:41 ·
update #1