| Hi,
Yes, that's what the manual says. But the source code does something
different. If the value is greater that 1 it will not use the seed value
unscaled, it will seed from current time. If the value is negative, it
will not cause seed re-initialization to be skipped. There's also the
check for (ss>FL(1.0)), which will never be true. So with the code as it
is is somewhat buggy and does not comform with the manual.
Should I just change the manual to the current action and forget the
whole thing?
Cheers,
Andrés
from Oops/ugens4.c:
int riset(CSOUND *csound, RANDI *p)
{
p->new = (*p->sel!=FL(0.0));
if (*p->iseed >= FL(0.0)) { /* new
seed: */
if (*p->iseed > FL(1.0)) { /* As manual suggest sseed in range
[0,1] */
unsigned long seed; /* I reinterpret >1 as a time seed */
seed = csound->GetRandomSeedFromTime();
csound->Message(csound, Str("Seeding from current time %lu\n"),
seed);
if (!p->new) {
short rand = (short)seed;
/* short ss = rand; */
/* IV - Jul 11 2002 */
p->num1 = (MYFLT)(rand) * DV32768; /* store num1,2 */
rand *= RNDMUL; /* recalc random */
rand += 1;
/* IV - Jul 11 2002 */
p->num2 = (MYFLT)(p->rand=rand) * DV32768;
/* printf("seed, rand, num1, num2 = %d(%x), %d*%x), %f, %f\n", */
/* ss,ss,p->rand, p->rand, p->num1, p->num2); */
}
else {
p->rand = randint31((long) (seed % 0x7FFFFFFEUL) + 1L);
p->rand = randint31(p->rand);
p->num1 = (MYFLT)(p->rand<<1) * dv2_31; /* store num1,2 */
p->rand = randint31(p->rand);
p->num2 = (MYFLT)(p->rand<<1) * dv2_31;
}
}
else if (!p->new) {
short rand = (short)(*p->iseed * FL(32768.0)); /* init rand integ */
rand *= RNDMUL; /* to 2nd value */
rand += 1;
p->num1 = *p->iseed; /* store num1,2 */
p->num2 = (MYFLT)rand * DV32768; /* IV - Jul 11 2002 */
p->rand = rand;
}
else {
MYFLT ss = *p->iseed;
if (ss>FL(1.0)) p->rand = (long) ss;
else p->rand = (long) (*p->iseed * FL(2147483648.0));
p->rand = randint31(p->rand);
p->rand = randint31(p->rand);
p->num1 = (MYFLT)(p->rand<1) * dv2_31; /* store num1,2 */
p->rand = randint31(p->rand);
p->num2 = (MYFLT)(p->rand<<1) * dv2_31;
}
p->phs = 0; /* & clear phs */
p->dfdmax = (p->num2 - p->num1) / FMAXLEN; /* & diff */
}
p->ampcod = (XINARG1) ? 1 : 0; /* (not used by krandi) */
p->cpscod = (XINARG2) ? 1 : 0;
return OK;
}
jpff wrote:
> The words say BETWEEN 0 and +1 one thing happens
> Values GREATER that 1 another thing happens
> For the value EXACTLY 1 a third thing happens.
>
> Do not see the problem
>
> ==John ffitch
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |