Here is a sub and a demo main program, the sub I have used in a program that creates art type pictures. It is not perfectly random but it is simple and good enough for most stuff.
Not going to say a lot about the program since I still think I can make some money with it.
As a teaser I will say it also uses a way of doing reentrant sub calls to about 40 levels deep.
Ok it makes fractal pictures.
If you run this on NCPlot turn off the drawing of the G0 moves.
Code:
O1000
#101=1(SEED FOR RAND)
#102=0(RAND RETURN -1 TO 1)
#1=2000(NUMBER OF POINTS)
G0X0Y0
G1X20.0
G1Y20.0
G1X0
G1Y0
WHILE[#1 GT 0]DO1
M98P9900
#24=[#102*10.0+10.0](X POSITION)
M98P9900
#25=[#102*10.0+10.0](Y POSITION)
G0 X[#24-0.1]Y[#25-0.1]
G1 X[#24+0.1]Y[#25+0.1]F10.0
G0 X[#24+0.1]Y[#25-0.1]
G1 X[#24-0.1]Y[#25+0.1]
#1=#1-1
END1
O9900(RAND)
#101=106*#101+1283
#101=#101-6075*FIX[#101/6075]
#102=[[#101/3037]-1.0]
M99