It should never repeat the same number within the 6 generated numbers. If same number is generated within the six, there is a routine to reject it and re-pick another number.
If you want to choose a different set of numbers, then press switch connected to PortA0
Target device can be easily changed. There is a note about this on the flowchart.
There are three issues with generating random numbers.
1) When using the format: Random_Number = (random()MOD 49)+1
When running simulator, numbers showing are between 1 and 255. On hardware numbers generated are between 1 and 49.
(Flowcode V4 only for a fix see JonnyW post below. Fixed with Flowcode V5)
2) On power up, numbers always start the same. So every time you reset, first number could always be 41, 2nd could be 26 etc.
I have got a way round this but there are probably better methods available. I have used the random() function within a loop that is determined by reading value of timer0 register. My theory is timer0 reg will increase by 1 every 4 clock cycles. since delays are not 100% precise, by the time the value of timer0 is read, in theory will have a different value each time. Hence random() will be run several times before actual lottery numbers are generated. So numbers should always be different on start-up.
3) If using random() function:
#include <rand.h> should be placed in Supplementary code window. ('View' 'Project Options' & click on 'Use Supplementary code')
This project is just for a bit of fun, but if you do use it and win, please give generously to the developer, say 1/2 - 1 million

