|
|
Invisible wrote:
> 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?
Well, one step is to develop a random number generator that kicks out a
number from 1 to 1000, with the frequency peaking at 10. Then generate
30 such numbers and sum them.
Or,
Generate 29970 random numbers from 0 to 1. Multiply each one by 29970.
For each product that is less than 220, add one to your running tally.
When you're all done, add 30 to the tally.
The tally will be a number between 30 and 30000, with the results
clustering around 250.
Regards,
John
Post a reply to this message
|
|