rem SmudgesAlt ......... Rev 1.0 rem A J Tooth // July 2007 rem ========================================== rem Simulates the Normal Distribution using rem the von Neumann Accept/Reject Algorithm. rem ========================================== rem Preamble================================== on error if (err=17) then quit *FLOAT 64 install @lib$+"MyUtils.bbc" rem Preamble================================== proc_fullscreen(xscreen%,yscreen%) *REFRESH OFF a$="" : cnt&=0 repeat colour 8,rnd(255),rnd(255),rnd(255) : gcol 8 origin rnd(2*xscreen%),rnd(2*yscreen%) sigh%=50+rnd(100) : sigv%=50+rnd(100) for a%=1 to 20000 x%=sigh%*fn_normal y%=sigv%*fn_normal move x%,y% : draw x%,y% if a%mod100=0 then *REFRESH next a% *REFRESH a$=inkey$(0) cnt&+=1 : if cnt&=10 then cls : cnt&=0 until a$<>"" *REFRESH ON proc_event(a$,b&) quit rem End of Program ============================================= rem ============================================================ rem Normal simulation def fn_normal local f&,x,z,y repeat f&=0 x=-6.0 + 12.0*rnd(1) z=exp(-x*x/2) y=rnd(1) if y