POV-Ray : Newsgroups : povray.general : How do I generate random numbers Server Time
8 Aug 2024 04:07:55 EDT (-0400)
  How do I generate random numbers (Message 1 to 8 of 8)  
From: Shay
Subject: How do I generate random numbers
Date: 4 Apr 2001 12:22:25
Message: <3acb4a41$1@news.povray.org>
I know that povray will do this, but can't find any info in the
instructions. Would someone please direct me towards some random number
generating instructions?

Thank you,
             Shay


Post a reply to this message

From: =Bob=
Subject: Re: How do I generate random numbers
Date: 4 Apr 2001 12:30:57
Message: <3acb4c41$1@news.povray.org>
Lot's of info at:

http://www.povray.org/links/3D_Tutorials/POV-Ray_Tutorials/

look up rand in the help.
=Bob=

"Shay" <sah### [at] simcopartscom> wrote in message
news:3acb4a41$1@news.povray.org...
: I know that povray will do this, but can't find any info in the
: instructions. Would someone please direct me towards some random number
: generating instructions?
:
: Thank you,
:              Shay
:
:


Post a reply to this message

From: Greg M  Johnson
Subject: Re: How do I generate random numbers
Date: 4 Apr 2001 23:12:04
Message: <3acbe284@news.povray.org>
This is the second time someone has asked this recently, and RFTM doesn't
apply here.
It is the case that the word "random" in the 3.1 help never brings up the
actual RAND() function: perhaps this should be changed for the 3.5 help.

Shay wrote:

> I know that povray will do this, but can't find any info in the
> instructions. Would someone please direct me towards some random number
> generating instructions?
>
> Thank you,
>              Shay


Post a reply to this message

From: Reuben Pearse
Subject: Re: How do I generate random numbers
Date: 5 Apr 2001 08:11:21
Message: <3acc60e9@news.povray.org>
Hi all,

I asked the same question recently and this is the reply I got from Margus
Ramst which I found very useful:

First you have to declare a random number seed, like this:

#declare RandSeed = seed(N); file://N is a random integer of your choice

The you can call the rand() function, with the name of the seed identifier
as
the parameter, for examle like this:

#declare RandomValue=rand(RandSeed);

Each time you call rand(RandSeed) a different (pseudo)random value is
returned
from the stream initialized by RandSeed.
For creating random numbers of a given mean value and maximum deviation, you
can
try these macros (the first returns a float, the second depends on the first
and
returns a 3D vector):

file://Create random number of given mean and maximum deviation
file://M - mean value
file://D - maximum deviation
file://Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
    (M+(rand(Seed)-.5)*2*D)
#end

file://Give a random vector of given mean and max deviation
file://M - mean (vector or float)
file://D - max deviation (vector or float)
file://Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
    #local MV=M+<0,0,0>;
    #local DV=D+<0,0,0>;
    (<rand_ext(MV.x,DV.x,Seed),
    rand_ext(MV.y,DV.y,Seed),
    rand_ext(MV.z,DV.z,Seed)>)
#end

Dooby

"Greg M. Johnson" <"gregj;-)56590\""@aol.c;-)om> wrote in message
news:3acbe284@news.povray.org...
> This is the second time someone has asked this recently, and RFTM doesn't
> apply here.
> It is the case that the word "random" in the 3.1 help never brings up the
> actual RAND() function: perhaps this should be changed for the 3.5 help.
>
> Shay wrote:
>
> > I know that povray will do this, but can't find any info in the
> > instructions. Would someone please direct me towards some random number
> > generating instructions?
> >
> > Thank you,
> >              Shay
>


Post a reply to this message

From: Ron Parker
Subject: Re: How do I generate random numbers
Date: 5 Apr 2001 09:43:18
Message: <slrn9cotjm.f0s.ron.parker@fwi.com>
On Wed, 04 Apr 2001 22:59:58 -0400, Greg M. Johnson wrote:
>It is the case that the word "random" in the 3.1 help never brings up the
>actual RAND() function: perhaps this should be changed for the 3.5 help.

That's actually true of a lot of functions.  Try finding cross product, or
normalize, or concatenate.  You can't find them in the index.  But short of
making an entire help page for each tiny function, there's not much that 
can be done about that, because that's the way help is.  That's why help
has a search function (cleverly disguised as that Find button in the top
left corner of the screen.)  Typing 'random' in the search box returns,
among other things, the "float functions" topic, and if you're using 
POV and you've even looked at the manual, you should be able to figure out
what sort of things you'd find in that topic.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Ron Parker
Subject: Re: How do I generate random numbers
Date: 5 Apr 2001 09:45:31
Message: <slrn9cotnt.f0s.ron.parker@fwi.com>
On Thu, 5 Apr 2001 13:12:55 +0100, Reuben Pearse wrote:
>I asked the same question recently and this is the reply I got from Margus
>Ramst which I found very useful:

Note that you'll have to remove the file: that Outlook Express helpfully
adds wherever it finds a // not followed by a space.  All hail Microsoft.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Tom Melly
Subject: Re: How do I generate random numbers
Date: 5 Apr 2001 10:24:07
Message: <3acc8007$1@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Thu, 5 Apr 2001 13:12:55 +0100, Reuben Pearse wrote:
> >I asked the same question recently and this is the reply I got from
Margus
> >Ramst which I found very useful:
>
> Note that you'll have to remove the file: that Outlook Express helpfully
> adds wherever it finds a // not followed by a space.  All hail Microsoft.

It could have been worse.

When a message has been posted by Outlook and received by Outlook, one might
have expected: file:file://foobar - this, at least, doesn't happen
(shocking - I hope someone was severely reprimanded for this glaring
oversight).


Post a reply to this message

From: Alf Peake
Subject: Re: How do I generate random numbers
Date: 7 Apr 2001 09:32:01
Message: <3acf16d1@news.povray.org>
For us poor souls lumbered with DOS Pov and VDBuerg's LISTing of Pov's
docs, _find random_ results in sensory overload :-/
However _rand(_ gets you there in 1 :)

Alf


Post a reply to this message

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