POV-Ray : Newsgroups : povray.newusers : Random Number Generation : Re: Random Number Generation Server Time
5 Sep 2024 10:26:09 EDT (-0400)
  Re: Random Number Generation  
From: Josh English
Date: 26 Feb 2001 16:33:52
Message: <3A9ACC15.43EEAC20@spiritone.com>
Chris Huff wrote:

> In article <3A9A89B3.F7059895@spiritone.com>, Josh English
> <eng### [at] spiritonecom> wrote:
>
> > something and something else can be vectors, but they will distribute
> > within a straight line, so you will have to do this in triplicate for
> > three different vectors to fill space.
>
> Triplicate for three different vectors? Not quite, you just need three
> calls to rand()...try these macros:
>
> // "signed rand", ranges from -1 to 1
> #macro SRand(RS) (rand(RS)*2 - 1) #end
>
> // "ranged rand"
> #macro RRand(Mn, Mx, RS) (Mn + rand(RS)*(Mx-Mn)) #end
>
> // random point in cube from Mn to Mx
> #macro RandPt(Mn, Mx, RS)
>     (Mn + < rand(RS), rand(RS), rand(RS)>*(Mx-Mn))
> #end

I feel so stupid for missing that. No wonder I gave up programming


--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/
"He who hebetates is last."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.