|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
474aa1aa$1@news.povray.org...
> 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?
Did you look in POV-Ray rand.inc? :-)
Marc
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
M_a_r_c wrote:
> Did you look in POV-Ray rand.inc? :-)
That's cute. No, I didn't - I'm at work right now. :-P
Besides, I doubt that precise distribution is present. ;-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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?
#if( rand(s1) < 0.1 )
#local N = rand(s1) * 29970 + 30;
#else
#local N = rand(s1) * 300 + 100;
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
scott wrote:
> #if( rand(s1) < 0.1 )
> #local N = rand(s1) * 29970 + 30;
> #else
> #local N = rand(s1) * 300 + 100;
> #end
Mmm, yeah, I guess that would work. :-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Invisible <voi### [at] devnull> wrote:
> 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?
http://en.wikipedia.org/wiki/Poisson_distribution
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> http://en.wikipedia.org/wiki/Poisson_distribution
Ooo... trippy:
http://en.wikipedia.org/wiki/Inverse_transform_sampling
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
--
Alain
-------------------------------------------------
Everybody should believe in something: I believe I'll have another drink.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |