the #include <rand.h> is taken care off
but the problem is when i try to run it it seems that my chip won't read the random
it always gives three times red an it shuold randomly change int re blue or green
can it be that my chip doesn't execute the random function??
Lottery Numbers Generator (Flowcode V4)
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Lottery Numbers Generator (Flowcode V4)
Hopefully this should make it much more random.
I have seeded the random function with timer0 interrupt.
(Not tested)
Radom is not as random as you could believe it is.
when power to chip is first applied the random number sequences will be the same every time.
See:
http://www.matrixmultimedia.com/mmforum ... 45&#p42090
Martin
I have seeded the random function with timer0 interrupt.
(Not tested)
Radom is not as random as you could believe it is.
when power to chip is first applied the random number sequences will be the same every time.
See:
http://www.matrixmultimedia.com/mmforum ... 45&#p42090
Martin
- Attachments
-
- keuze ledjes3.fcf
- (26.61 KiB) Downloaded 428 times
Martin
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: Lottery Numbers Generator (Flowcode V4)
Hello.
It helps to get something that feels more random if your program requires some human interaction. The chip may not behave randomly but people do.
Try waiting until the user pushes a button before starting, and before they do, spin in a loop seeding/calling the random number. This should get a more random outcome.
Jonny
It helps to get something that feels more random if your program requires some human interaction. The chip may not behave randomly but people do.
Try waiting until the user pushes a button before starting, and before they do, spin in a loop seeding/calling the random number. This should get a more random outcome.
Jonny
Re: Lottery Numbers Generator (Flowcode V4)
thanks for the help when i tested it i wil tell you if it works