 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Invisible" <voi### [at] dev null> a écrit dans le message de news:
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] dev null> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> Invisible <voi### [at] dev null> 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
I'd have used a Gaussian - any particular reason to choose a Poisson?
--
Isn't it counterproductive to have incandescent bulbs in a fridge?
/\ /\ /\ /
/ \/ \ u e e n / \/ a w a z
>>>>>>mue### [at] nawaz org<<<<<<
anl
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mueen Nawaz wrote:
> Warp wrote:
>> Invisible <voi### [at] dev null> 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
>
> I'd have used a Gaussian - any particular reason to choose a Poisson?
100 and 400 are both nearer to 30 than to 30,000?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Depends on how efficient or accurate it needs to be.
A simple but inefficient way is to create a curve
function that represents the desired distribution,
generate two random numbers representing an
X,Y vector on the chart, then reject the points
above the curve, and use the X value of accepted
points as the random value.
An efficient but more complicated method is
to create a bar graph approximation of the
distribution curve, then "stack" the rectangles.
Then you can create an X,Y vector guaranteed
to be inside the stack of rectangles, then figure
the X offset of the rectangle based on Y and
use X + X offset @ Y as your random value.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> 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. :-)
I saw the question, came to the same answer, and anticipated the same
response, even it had been in haskell. Don't you have some flirting you
should be catching up with?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Galvin wrote:
> I saw the question, came to the same answer, and anticipated the same
> response, even it had been in haskell. Don't you have some flirting you
> should be catching up with?
That requires a partner. :-P
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Tom Galvin wrote:
>
>> I saw the question, came to the same answer, and anticipated the same
>> response, even it had been in haskell. Don't you have some flirting
>> you should be catching up with?
>
> That requires a partner. :-P
You could always flirt with yourself. Mind you don't go blind, though.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Bill Pragnell wrote:
> You could always flirt with yourself. Mind you don't go blind, though.
Oh that's cute. :-P
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bill Pragnell" <bil### [at] hotmail com> a écrit dans le message de news:
474d8e1d$1@news.povray.org...
>
> You could always flirt with yourself. Mind you don't go blind, though.
Let's not forget the kittens
http://en.wikipedia.org/wiki/Image:God-kills-kitten.jpg
Marc
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
M_a_r_c wrote:
> Let's not forget the kittens
http://lolcat.com/godkills.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v7 wrote:
> M_a_r_c wrote:
>
>> Let's not forget the kittens
>
> http://lolcat.com/godkills.html
Ceiling cat is watching you kill kittens?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Sabrina Kilian wrote:
> Orchid XP v7 wrote:
>> M_a_r_c wrote:
>>
>>> Let's not forget the kittens
>> http://lolcat.com/godkills.html
>
> Ceiling cat is watching you kill kittens?
A new euphemism is born: "sorry I didn't hear the phone, I was upstairs
killing the kittens..."
:)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
You're only half right: every time a *guy* masturbates, God kills a
kitten. Every time a *girl* masturbates, an angel gets its wings.
;)
--
Tim Cook
http://home.bellsouth.net/p/PWP-empyrean
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tim Cook wrote:
> You're only half right: every time a *guy* masturbates, God kills a
> kitten. Every time a *girl* masturbates, an angel gets its wings.
>
> ;)
Woah... I seem to have stumbled into a very scary place here... o_O
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Sabrina Kilian wrote:
> Orchid XP v7 wrote:
>> M_a_r_c wrote:
>>
>>> Let's not forget the kittens
>> http://lolcat.com/godkills.html
>
> Ceiling cat is watching you kill kittens?
Hai! Teh blessigs of teh Ceiling Cat b pwn u, lol!
http://www.lolcatbible.com/index.php?title=Genesis_1
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Tom Galvin wrote:
>
>> I saw the question, came to the same answer, and anticipated the same
>> response, even it had been in haskell. Don't you have some flirting
>> you should be catching up with?
>
> That requires a partner. :-P
I don't think you understand what flirting is. It's how you get a partner.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Galvin wrote:
> Hai! Teh blessigs of teh Ceiling Cat b pwn u, lol!
>
> http://www.lolcatbible.com/index.php?title=Genesis_1
Oh.
My.
God.
It's true: *everything* exists on the Internet! 0_0
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Galvin wrote:
> I don't think you understand what flirting is. It's how you get a partner.
OK, I rephrase: I'd still need somebody to flirt at. :-P
(Leaving aside the small matter that I've never flirted with anybody in
my life and I wouldn't even begin to know how...)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am Fri, 30 Nov 2007 09:07:45 +0000 schrieb Invisible:
> (Leaving aside the small matter that I've never flirted with anybody in
> my life and I wouldn't even begin to know how...)
For starters: Look at your target and smile... (I know it's hard, been
down that road too.)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Michael Zier wrote:
> Am Fri, 30 Nov 2007 09:07:45 +0000 schrieb Invisible:
>
>> (Leaving aside the small matter that I've never flirted with anybody in
>> my life and I wouldn't even begin to know how...)
>
> For starters: Look at your target and smile... (I know it's hard, been
> down that road too.)
Bah. I smile at people all the time! They *still* don't like me very much...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |