POV-Ray : Newsgroups : povray.newusers : random elements in blob object Server Time
5 Sep 2024 06:14:34 EDT (-0400)
  random elements in blob object (Message 11 to 20 of 24)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>
From: Deaken
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:03:01
Message: <3C5FBC39.8BF959D6@sw-tech.com>
Tom Melly wrote:
> 
> #declare S1 = seed(32534);
> #while(1=1)
>     #declare S2 = seed(rand(S1))
>     object{foo translate y*rand(S2)}
> #end
> 
> Here, you get some variation for rand(S2), but not a lot. This is because the
> seed to S2 is always in the range 0 -> 1, which returns a random stream with
> very little variation.

Wait.  The way I'm reading this, the smaller the (absolute value of the)
seed is, the less the stream varies.

Please tell me that I'm misunderstanding.

If I'm not, can someone post a brief summary (my C is very bad) of why
(computer, not design decision) this is?

Deaken


Post a reply to this message

From: Warp
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:23:44
Message: <3c5fc0c0@news.povray.org>
Deaken <dwy### [at] sw-techcom> wrote:
: If I'm not, can someone post a brief summary (my C is very bad) of why
: (computer, not design decision) this is?

  Perhaps seed() takes just the integer part of the given parameter?
(I don't know, I'm just guessing.)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Deaken
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:30:58
Message: <3C5FC2C7.DEC8D4C8@sw-tech.com>
Warp wrote:
> 
> Deaken <dwy### [at] sw-techcom> wrote:
> : If I'm not, can someone post a brief summary (my C is very bad) of why
> : (computer, not design decision) this is?
> 
>   Perhaps seed() takes just the integer part of the given parameter?
> (I don't know, I'm just guessing.)

The docs for 3.1 say that seed() takes a float.  I can't find the relevant
part in the 3.5 docs.

Deaken


Post a reply to this message

From: Christopher James Huff
Subject: Re: random elements in blob object
Date: 5 Feb 2002 11:15:22
Message: <chrishuff-54F93A.11165805022002@netplex.aussie.org>
In article <3C5FBC39.8BF959D6@sw-tech.com>, Deaken <dwy### [at] sw-techcom> 
wrote:

> Wait.  The way I'm reading this, the smaller the (absolute value of the)
> seed is, the less the stream varies.

No, the less the seed varies, the less the stream varies (from other 
streams, not internally). Since only the first random number of each 
stream is used, this means there will be some variation, but it won't be 
random.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Deaken
Subject: Re: random elements in blob object
Date: 6 Feb 2002 00:41:29
Message: <3C60C261.76F55F00@sw-tech.com>
Christopher James Huff wrote:
> 
> In article <3C5FBC39.8BF959D6@sw-tech.com>, Deaken <dwy### [at] sw-techcom>
> wrote:
> 
> > Wait.  The way I'm reading this, the smaller the (absolute value of the)
> > seed is, the less the stream varies.
> 
> No, the less the seed varies, the less the stream varies (from other
> streams, not internally). Since only the first random number of each
> stream is used, this means there will be some variation, but it won't be
> random.

Okay, thanks.  That's good to know.

Just as an aside, and feel free to ignore this question, how many values
would you suggest throwing away before the streams are no longer "close"?

Deaken


Post a reply to this message

From: Tom Melly
Subject: Re: random elements in blob object
Date: 6 Feb 2002 09:34:03
Message: <3c613edb@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message news:3c5fc0c0@news.povray.org...
> Deaken <dwy### [at] sw-techcom> wrote:
> : If I'm not, can someone post a brief summary (my C is very bad) of why
> : (computer, not design decision) this is?
>
>   Perhaps seed() takes just the integer part of the given parameter?
> (I don't know, I'm just guessing.)

Nah - it's just that the stream created with seed(0.5) is very similiar to the
stream created with seed(0.6) - well IMHO, it certainly fits the symptoms. I
fell into this trap a couple of times. It was weird, things weren't exactly
identical, but nor were they random. All streams generated by seeds within a
range of 1 are pretty similiar.

If you want to use one stream as the seed for another, do something like

 R2 = seed(rand(R1)*1000)


Post a reply to this message

From: Warp
Subject: Re: random elements in blob object
Date: 6 Feb 2002 16:11:46
Message: <3c619c12@news.povray.org>
Tom Melly <tom### [at] tomandlucouk> wrote:
:>   Perhaps seed() takes just the integer part of the given parameter?
:> (I don't know, I'm just guessing.)

: Nah - it's just that the stream created with seed(0.5) is very similiar to the
: stream created with seed(0.6) - well IMHO, it certainly fits the symptoms.

  I don't think so. If you make a simple test, you'll see that there's
absolutely no difference between seed(0), seed(0.5) and seed(0.6). I have
the strong feeling that seed() takes just the integer part of the parameter.
I can try to check this from the source code.

#declare S1=seed(0.5);
#declare S2=seed(0.6);
#declare S3=seed(0);

#declare Ind=0;
#while(Ind<100)
  #declare n1 = rand(S1);
  #declare n2 = rand(S2);
  #declare n3 = rand(S3);
  #debug concat(str(rand(S1),0,17), " ",
                str(rand(S2),0,17), " ",
                str(rand(S3),0,17), " ")
  #if(n1=n2 & n2=n3) #debug "equal\n"
  #else #debug "different\n"
  #end
  #declare Ind=Ind+1;
#end

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Warp
Subject: Re: random elements in blob object
Date: 6 Feb 2002 16:15:47
Message: <3c619d02@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
: I can try to check this from the source code.

  In express.cpp:

          case SEED_TOKEN:
            Val = stream_seed((int)Parse_Float_Param());
            break;


  I rest my case.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Ron Parker
Subject: Re: random elements in blob object
Date: 6 Feb 2002 16:18:44
Message: <slrna637dn.648.ron.parker@fwi.com>
On 6 Feb 2002 16:15:47 -0500, Warp wrote:
> Warp <war### [at] tagpovrayorg> wrote:
>: I can try to check this from the source code.
> 
>   In express.cpp:
> 
>           case SEED_TOKEN:
>             Val = stream_seed((int)Parse_Float_Param());
>             break;
> 
> 
>   I rest my case.

How do we know you didn't just make that up?  Just where is this express.cpp
anyway? :)

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Warp
Subject: Re: random elements in blob object
Date: 6 Feb 2002 16:32:41
Message: <3c61a0f9@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: How do we know you didn't just make that up?  Just where is this express.cpp
: anyway? :)

  It's identical to how it's done in express.c in the POV-Ray 3.1g source
(anyone can check this), and for now you only have to trust me that this
hasn't been changed in the 3.5 source code (it can be checked when the
source is released). :)

  (Of course "you" here is in plural. Naturally you, Ron, can check it
right away. :) )

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>

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