Codesnippets > Math

Schranzors Rand und Gernots Kreis

<< < (2/2)

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)

--- End code ---

I just replaced the b with the e  :P


[0] Message Index

[*] Previous page

Go to full version