|
|
Invisible nous apporta ses lumieres en ce 2007/11/26 05:36:
> OK, so unlike the Euler project, *this* question has some practical use.
> ;-)
>
> Anybody have any idea how I can make a program generate random numbers
> between 30 and 30,000, but so that "most" of the numbers generated are
> actually in the range 100 - 400?
A possibility: Use the division of some random numbers. The divider must have a
range starting at 1.
Samples: rand(X)*29970/(rand(X)*Z+1)+30
(rand(X)+rand(X))*14985/(rand(X)*Z+1)+30
Adjusting Z will shift the peak. Low Z for high location, larger Z for lower
location.
--
Alain
-------------------------------------------------
Everybody should believe in something: I believe I'll have another drink.
Post a reply to this message
|
|