>>Does anyone have any code suitable for generating pseudo random >>numbers in a presettable range ? (say 1-20 or 1-50) Or perhaps >>some way of randomly re-ordering the numbers 1-20 in a table ? >>What I want to do is generate a table of (say 20) numbers in a >>sequence such as 2,15,8,1,19,12,etc with all numbers up to the >>specified max used. It's a bit like Bingo where eventually every >>number will come up but not in any obvious order. Also, each >>"run" sequence needs to be different from the last one. I know >>that it's a tall order but even a starting point would help. >Craig Webb wrote; >The most "random" method I would suggest, to have different run sequences, >is to have a counter incremementing in your main code loop and then to copy >it to a random "seed" variable with each button press (i.e. maybe the >counter is cycling during your "Button-press" wait loop). Then, once you get >it, you can XOR it with the RTCC or something if you really want something >random. Sounds good but there's one small glitch - no push button ! The code runs all by itself with no user input. I can see how I could let the RTCC run and pick a seed for random routine that way, as the unit gets feedback from other equipment every hour or so and that's when I need the new random run sequence. The time period between events varies between 50 and 70 minutes. But I can't see a way to generate the list of all 20 numbers in random order. The only thing that springs to mind is generating lots of random numbers and throwing away any that are out of desired range or are duplicates. Maybe I'm missing an obvious solution but it has been a long day ! Regards... _______________________________________________________________ Dave Duffy Audio Visual Devices AVD@uq.net.au Unit 8, 9-11 Trade Street, Cleveland, Queensland 4163 Australia Phone: +61 7 38210362 Facsimile: +61 7 38210281 _______________________________________________________________