450 LET REPEAT=0
500 RAND
510 LET EVENT=INT (RND*2)+1
515 IF REPEAT=EVENT GOTO 500
#THE 1ST TIME OBVIOUSLY REPEAT CANT BE EQUAL TO EVENT AS IT IS SET TO 0
517 LET REPEAT=EVENT
520 IF EVENT=1 THEN PRINT EVENT
530 IF EVENT=2 THEN PRINT EVENT
540 IF EVENT=3 THEN PRINT EVENT
580 GOTO 500
I just don't want the same number to come up TWICE in a row.
ps. (hidden sneaky question) Does rand do anything there? Does it indeed cause a randomization?
RAND X, will start the sequence of random numbers at a fixed point in a sequence of 65536 numbers and will be the same every time for a given value of X, whereas RAND 0 or without the 0 will start the sequence at a point determined by how long the TV has been switched on.
Taken from the ZX81 manual, it gives a fuller explanation of both RND and RAND.
RND & RAND: These are both on the same key, but whereas RND is a function, RAND is a keyword, like PRINT. RAND is used for controlling the randomness of RND.
RND is not truly random, but follows a fixed sequence of 65536 numbers that happen to be so jumbled up as to appear random (RND is pseudo-random). You can use RAND to start RND off at a definite place in this sequence by typing RAND, & then a number between 1 & 65535, & then NEWLINE. It's not so important to know where a given number starts RND off, as that the same number after RAND will always start RND off at the same place. For instance, type
RAND 1 (& NEWLINE)
& then
PRINT RND
& type both these in turn several times. (Remember to use FUNCTION to get RND.) The answer from RND will always be 0.0022735596, not a very random sequence.
RAND 0
(or you can miss out the 0) acts slightly differently: it judges where to start RND off by how long the television has been on, & this should be genuinely random.