Log In  

While PICO does indeed provide us with a good RND() function, what did people do before RND() was created ? Well, they used math, and as I like to call it, swinging a paint bucket. :)

Here is some code from my QBasic source to demonstrate almost perfect random ability without using RND() at all.

What would be your method for creating a random number in PICO without using RND() ?

speed=100

function fnr(a)
  if (sd==nil) sd=time()
  sd=sd*125%24584
  return sd%a
end

s=0

cls()
repeat
  pset(fnr(128),fnr(128),fnr(16))
  if (s%speed==0) flip()
  s+=1
until forever

Feel free to fudge the numbers above to make a more accurate random if you think you can. The "24584" number especially.

P#56537 2018-09-11 14:37 ( Edited 2018-09-11 18:46)


[Please log in to post a comment]