|
![](/i/fill.gif) |
Warp wrote in message <3a93fda4@news.povray.org>...
> Rune <run### [at] iname com> wrote:
> : Basically it will never be of any use to use rand( seed( VAL ) ) no matter
> : what "VAL" is, because it won't add any randomness at all.
>
> What he wanted was that a certain pair of values is converted to some
> value (always the same value). Each time the function is called with a
> certain pair of values, the same result is returned. This value should
> be "random" in the way that there's no (easily) visible connection between
> the input values and the result.
> For this rand(seed(VAL)) works quite well. It returns a value from 0 to 1
> which is seemingly not related to VAL.
but this works fine
I've checked and compared results for independent running and for independent
loops of one running
it is little slow but as I said - it works
// start of file
#declare Generator=seed(0);
#declare RandTable=array[1][3]
#macro Extend(Table,I1,I2,R)
#local Counter=0;
#local End=no;
#while (!End)
#ifndef (Table[Counter][0])
#local End=yes;
#else
#local Counter=Counter+1;
#end
#end
#local NewTable=array[Counter+2][3]
#local NewTable[Counter][0]=I1;
#local NewTable[Counter][1]=I2;
#local NewTable[Counter][2]=R;
#while (Counter>0)
#local Counter=Counter-1;
#local NewTable[Counter][0]=Table[Counter][0];
#local NewTable[Counter][1]=Table[Counter][1];
#local NewTable[Counter][2]=Table[Counter][2];
#end
NewTable
#end
#macro RandForRunesParticles(I1,I2)
#local Counter=0;
#local Found=no;
#local End=no;
#while (!End)
#ifndef (RandTable[Counter][0])
#local End=yes;
#else
#if ((RandTable[Counter][0]=I1)&(RandTable[Counter][1]=I2))
#local Found=yes;
#local End=yes;
#end
#local Counter=Counter+1;
#end
#end
#if (Found)
#local R=RandTable[Counter-1][2];
#else
#local R=rand(Generator);
#declare RandTable=Extend(RandTable,I1,I2,R)
#end
R
#end
// end of file
ABX
Post a reply to this message
|
![](/i/fill.gif) |