POV-Ray : Newsgroups : povray.advanced-users : Random number generator needed ! : Re: Random number generator needed ! Server Time
30 Jul 2024 00:28:50 EDT (-0400)
  Re: Random number generator needed !  
From: Wlodzimierz ABX Skiba
Date: 21 Feb 2001 08:26:16
Message: <3a93c1f8@news.povray.org>
Rune wrote in message <3a92cca8@news.povray.org>...
> I need a macro that outputs a random number between 0 and 1 when called. It
> should have two integers as input. The reason I can't just use rand() and
> seed() is that I need it to always output the same random number when the
> same input numbers are used.
>
> I need a macro like this: Rand (Int1, Int2)
>
> I don't know anything about random number generators myself, so some help
> would be much appreciated.


perhaps this will help you:

#macro Rand(I1,I2)
  rand(seed(val(concat(str(I1,0,0),str(I2,0,0)))))
#end

ABX


Post a reply to this message

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