I found the RANDOM function to be pretty good for number distribution. I can't find it now but I had PBP generate groups (up to thousands) of numbers in the range I needed. I captured these a comma delimited file that I opened in Excel and looked at the distribution. It was plenty good enough for what I wanted but would not satisfy the lotteries commission.
If the system has a human operator, I start with a randomised seed as follows:-
Button is to ground with a resistor pullup to +5V
Code:
Pseudocode
Pushbutton var portb.0
w var word
lcdout $FE, $01, "Press button to start"
GetSeed:
random w
if pushbutton = 0 then SeedFound
goto getseed
SeedFound:
lcdout $FE, $01, "Seed = ", #W
W is now a random number between 1 and 65535. 0 is never produced. You need to scale this to the range you are interested in either by division as you are doing or by repeating the random instruction until a value that falls in your range is produced. The system is defeated if the user holds the button down before powering up. Needs a check for that.
This approach relies on a human operator seeing the LCD instruction then pushing the button to stop the counter. Due to reflex times, etc, it generates a pretty good random number.
If the system has no human to press the button, I have used a fast loop between turn on and the next positive going zero crossing of the mains. This needs an opto or similar way of finding the zero crossing.
The only better way that I know of is to use a white noise generator.
Your second code example I think has a problem. I don't think it will ever produce 0 or 1 since it returns to LOOP if time < 2. The random//11 function returns values 0 to 10 so the test for TIME > 10 is never true.
HTH
BrianT
Bookmarks