I found the following from the PIClist archive and it claims to be better than Andrew Warren's LFSR. Why? Regards, Xiaofan ;***************************************** ;PRNG 8 bits ;by Nikolai Golovchenko ;Seed RANDOM with a number different to 0 ;during initialization. ;This code gives less sequential repetitions ;at edges (0 to 32, 224 to 255) ;than Andrew Warren's LFSR: CLRC RLF RANDOM, 1 SWAPF RANDOM, 0 ANDLW 0XE0 RRF RANDOM, 1 ADDWF RANDOM, 0 ADDWF RANDOM, 0 ADDWF RANDOM, 0 SUBLW 0X35 MOVWF RANDOM RETURN -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist