POV-Ray : Newsgroups : povray.off-topic : A small statistics question Server Time
5 Nov 2024 03:17:12 EST (-0500)
  A small statistics question (Message 1 to 10 of 29)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: A small statistics question
Date: 26 Nov 2007 05:36:26
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?


Post a reply to this message

From: M a r c
Subject: Re: A small statistics question
Date: 26 Nov 2007 05:48:44
Message: <474aa48c$1@news.povray.org>

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

From: Invisible
Subject: Re: A small statistics question
Date: 26 Nov 2007 05:59:56
Message: <474aa72c$1@news.povray.org>
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

From: scott
Subject: Re: A small statistics question
Date: 26 Nov 2007 06:05:32
Message: <474aa87c$1@news.povray.org>
> 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

From: Invisible
Subject: Re: A small statistics question
Date: 26 Nov 2007 06:09:58
Message: <474aa986$1@news.povray.org>
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

From: Warp
Subject: Re: A small statistics question
Date: 26 Nov 2007 07:03:56
Message: <474ab62c@news.povray.org>
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

From: Invisible
Subject: Re: A small statistics question
Date: 26 Nov 2007 07:37:28
Message: <474abe08@news.povray.org>
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

From: Alain
Subject: Re: A small statistics question
Date: 26 Nov 2007 16:02:29
Message: <474b3465$1@news.povray.org>
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

From: John VanSickle
Subject: Re: A small statistics question
Date: 26 Nov 2007 16:25:49
Message: <474b39dd$1@news.povray.org>
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

From: Alain
Subject: Re: A small statistics question
Date: 26 Nov 2007 19:24:29
Message: <474b63bd$1@news.povray.org>
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

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.