POV-Ray : Newsgroups : povray.newusers : Using rand(); clear howto! : Re: Using rand(); clear howto! Server Time
5 Sep 2024 08:16:50 EDT (-0400)
  Re: Using rand(); clear howto!  
From: Simon Lemieux
Date: 11 May 2001 11:39:33
Message: <3AFBD050.CC80AF1D@yahoo.com>
>   Do you make that in C++ as well? That is, something like:
> 
> for(int i=0; i<n; ++i)
> {
>   srand(i);
>   int x = rand();
>   srand(i+1);
>   int y = rand();
> }
> 
>   I suppose not. But that's what you are doing in the povray code.

Yeah I know this looks extremely silly!  I was just confused from the manual
that used more than one seed at a time.. So I thought that you needed a new seed
for every rand()...  That's the reason why I prefered C++, but now that I
understand how it works, I realized I was just dumb!

Thanks,
  Simon

-- 
+--------------------------------+---------------------------+
| Simon Lemieux                  | http://666Mhz.myip.org/   |
| Email : lem### [at] yahoocom | Povray and OpenGL Gallery |
+--------------------------------+---------------------------+


Post a reply to this message

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