|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello there,
I have a question about random and seed. First one have to declare seed(A).
Will random then return a value between A and A+1? If that is the case I
understood the manual correctly.
thanks, kobus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
kobus wrote:
>
> Hello there,
>
> I have a question about random and seed. First one have to declare seed(A).
> Will random then return a value between A and A+1? If that is the case I
> understood the manual correctly.
>
> thanks, kobus
Rand will always return a value from 0 to 1. The seed number will determine
where between 0 and 1 the value starts.
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <01bf7e50$a4f58320$667dd383@etnica.ibb.uu.nl>, "kobus"
<kob### [at] hotmailcom> wrote:
> Hello there,
>
> I have a question about random and seed. First one have to declare
> seed(A).
> Will random then return a value between A and A+1? If that is the case I
> understood the manual correctly.
The rand() function always returns a value between 0 and 1. Specifying a
different seed will just give a different sequence of random numbers.
Most computer random number generators are actually pseudo-random. They
produce a specific sequence of numbers from each seed value. If you use
seed(444), you will get a different sequence from what you would get if
you used seed(999), and that sequence will always be the same.
--
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Chris Huff wrote:
>
> If you use, seed(444), you will get a different sequence from
> what you would get if you used seed(999), and that sequence
> will always be the same.
Yes, and thus your image will always render the same.
As for the initial question, do the following :
s = seed(1234) ;
[...] A+random(s) [...]
This way you will get a number between A and A+1.
And if the result is not satisfying, just change 1234 into something
else.
--
JM
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <38B52852.548D6481@via.ecp.fr>, Jean-Michel Grimaldi
<jm### [at] viaecpfr> wrote:
> Yes, and thus your image will always render the same.
> As for the initial question, do the following :
> s = seed(1234) ;
> [...] A+random(s) [...]
> This way you will get a number between A and A+1.
> And if the result is not satisfying, just change 1234 into something
> else.
Not "random()", "rand()". But this gives me an idea...
#macro random(Sd, Mn, Mx)
(rand(Sd)*(Mx-Mn) + Mn)
#end
Now, this should let you use "random(stream, min_limit, max_limit)" for
your random numbers, where stream is the variable initialized by seed().
The other two should be pretty explanatory.
I haven't had time to test it though. :-)
#declare S = seed(589743);
sphere {< random(S,-1, 2), 0, 0>, 0.1}
--
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Chris Huff wrote:
>
> Not "random()", "rand()". But this gives me an idea...
>
Two macros that do the same, used & tested:
//Create random number of given mean and maximum deviation
//M - mean value
//D - maximum deviation
//Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
(M+(rand(Seed)-.5)*2*D)
#end
//Give a random vector of given mean and max deviation
//M - mean (vector or float)
//D - max deviation (vector or float)
//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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|