POV-Ray : Newsgroups : povray.beta-test : Rand() problems (rand.inc and with functions) : Rand() problems (rand.inc and with functions) Server Time
30 Jul 2024 12:23:24 EDT (-0400)
  Rand() problems (rand.inc and with functions)  
From: Redbeard
Date: 9 Nov 2001 23:32:41
Message: <3becade9@news.povray.org>
I don't recall either of these being posted.  Both are for POV-Ray 3.5 beta 7,
Win98SE, PIII 733/160, Athlon 700/192.

First, in rand.inc, the following change should be made to Vrand_In_Box:

#macro VRand_In_Box(Mn, Mx, RS) (< rand(RS), rand(RS), rand(RS)>*(Mx-Mn) + Mn)
#end

As it is currently written, it provides numbers outside the specified bounds,
since SRand returns [-1,1].

Second, I know (now) that rand is not valid in functions (it should be, IMHO),
but if you try with #declare F = function { rand(x) }

you get:
#declare F = function { rand(x) } <----ERROR

Parse Error: Expected 'function identifier', } found instead

I'm not exactly sure what this error is intended to mean.  All I know is it
should have choked on rand and given an error there, instead.  Or I could be
completely wrong.

An argument in favor of making rand usable in functions (there's probably
several against, and I might have read them at some point) is that it would make
most of the non-VRand macros in rand.inc much more efficient (as functions
instead of macros).

Michael
--
#macro M(D,J)text{ttf"cyrvetic.ttf"D 1,0translate-J}#end#macro N(E,K)#local A=
M(E,K)light_source{-z*30rgb 1projected_through{A}}#end N("Michael"<1.6,-.2,5>)
N("Johnson"<1.9.8,5>)sphere{z*9,4pigment{gradient x+y scale 10color_map{[0 rgb
x][1rgb x+y]}sine_wave}} // (c)2001 Michael D Johnson red### [at] wvadelphianet


Post a reply to this message

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