Codesnippets > Math

Schranzors Rand und Gernots Kreis

<< < (2/2)

Moebius:
Useful, but with one problem:
QRND(100) returns values from 100-200 instead of 0-100...
QRND(n) returns values from n to 2*n instead of 0 to n...

Try this instead:

--- Code: (glbasic) ---FUNCTION QRND: b, e=0 , scale=1
LOCAL n = ABS(e-b)
RETURN e + n/(scale*n)*RND(scale*n)
ENDFUNCTION

--- End code ---

I just replaced the b with the e  :P

Navigation

[0] Message Index

[*] Previous page

Go to full version