POV-Ray : Newsgroups : povray.advanced-users : rand help : Re: rand help Server Time
29 Jul 2024 22:30:19 EDT (-0400)
  Re: rand help  
From: Marc-Hendrik Bremer
Date: 3 Dec 2000 15:50:55
Message: <3a2ab22f$1@news.povray.org>
First of all, you have to define a seed by "#declare MySeed=seed
(AnyNumber)". (Substitute AnyNumber with any Number :-))

You get a pseudorandom-number between 0 and 1 by "rand(MySeed). As I read
it, MySeed is changed by this process, so you get another random Number in
the sequence if you use rand(MySeed) again. If you redeclare MySeed with
seed(AnyNumber) you start the sequence (or another if 'AnyNumber' is
different) again.

To narrow the range you can use

#declare MyRandomNumber=MyFloor+(rand(MySeed)/(MyCeilling-MyFloor));

with MyCeiling=1 and MyFloor=0.75 in your case.

Hope that helps,

Marc-Hendrik


Post a reply to this message

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