|
![](/i/fill.gif) |
rand() returns a value in [0..1[, which is as general as it gets, but I
often need a random value in [A-B..A+B].
Of course I could write
#declare myvar = A + B * ( 2 * rand(rnd) - 1 );
but I would love to have a function, say rand2(), which I could use as e.g.
#declare myvar = rand2(rnd, A, B);
or even
sphere { < rand2(rnd, A, B), rand2(rnd, A, B), rand2(rnd, A, B) >, 100 }
Is this possible? I gather that I can't use rand() in user-defined
functions.
TIA
Steven
Post a reply to this message
|
![](/i/fill.gif) |