POV-Ray : Newsgroups : povray.binaries.images : Help needed for random numbers : Re: Help needed for random numbers Server Time
14 Aug 2024 07:15:27 EDT (-0400)
  Re: Help needed for random numbers  
From: Slime
Date: 14 Nov 2002 15:33:08
Message: <3dd40884$1@news.povray.org>
> out of interest what does the value in seed(value) actually do?is it a
list
> of numbers or a maximum value?


Neither. It sorta works like this:

Each random number you get depends on the previous one. It takes the
previous random number that you got, puts it through a function, and gives
you the result. The function changes the number in such a way that there
shouldn't be any really good relationship between the input and the output.
So the output now will be the input next time. This way, each time you call
rand(), you get a new random number.

seed() merely specifies the first number to use as the input. So if you
start with the same seed, you'll get the same list of random numbers, but
different seeds should give randomly different lists of random numbers.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

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