POV-Ray : Newsgroups : povray.advanced-users : Mandelbrots, Rand, and maybe more... : RE: Mandelbrots, Rand, and maybe more... Server Time
2 Nov 2024 15:25:22 EDT (-0400)
  RE: Mandelbrots, Rand, and maybe more...  
From: Anders Haglund
Date: 29 May 1999 09:43:54
Message: <374fe10a.0@news.povray.org>
Darcy Johnston <djo### [at] inamecomNOSPAM> wrote:
> Ken <tyl### [at] pacbellnet> wrote in message
> news:374F6CCC.82E06A57@pacbell.net...
> > Rand:
> >
> >   When a value is returned from the rand function is there a range
> > it is confined to i.e. 0 - 1,  .1 - 10, or ?
> >
> > Is the value returned always a fraction of 1, or less than 100 or can be
> > anything up to and including 20 billion.
>
> According to the docs:
> "The numbers are uniformly distributed, and have values between 0.0 and
1.0,
> inclusively."
>
> But I guess with a little massaging of the numbers, you can make it come
out
> to most any range.

You could allways do a small macro, something like:

#macro rand2(rand_min,rand_max,rseed)
    rand_min + (rand_max - rand_min) * rand(rseed)
#end

...written from the top of my head but it should work just fine. I love
macros :)

/Anders


Post a reply to this message

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