|
|
Am 17.01.2015 um 02:05 schrieb eticre:
> this fail
>
> #declare rndx=seed(123);
> #macro rnr(nrx,mii,mxx)
> #if(mii>=0)
> (rand(nrx)*(mxx-mii+1)) + mii
> #else
> mii+(mxx-mii)*rand(nrx) ///////// LINE 40
> #end
> #end
>
> #local d=0;
> #local d=rnr(rndx,-20,20);
This is a known issue rooted deep in the current parser (and not due to
be fixed before implementation of a brand new parser); to work around,
first assign the expression to a local variable, then finally "return" that:
#macro rnr(nrx,mii,mxx)
#if(mii>=0)
#local result = (rand(nrx)*(mxx-mii+1)) + mii;
#else
#local result = mii+(mxx-mii)*rand(nrx);
#end
result
#end
The issue reported by the OP, however, is that this construct allegedly
doesn't always seem to work either; but for the time being I presume
that Anthony accidently did something wrong.
Post a reply to this message
|
|