If you read the section on Random, you will see that your output variable is also used as the seed. Try to use Random Time instead of Random Temp. That way your seed is changed after each use. In your code Temp is unnecessary anyway.
If you read the section on Random, you will see that your output variable is also used as the seed. Try to use Random Time instead of Random Temp. That way your seed is changed after each use. In your code Temp is unnecessary anyway.
I'm not so sure about that, if I use time as my seed it will always be smaller then 2730, (time / 24) Will this not affect the output of the random generator?
i.e. does the seed need to be a 16 bit number or not?
Okay, I did a little test:
If I try this code:
My LED flashes in a very nicely random way.Code:loop: random temp toggle LED pause temp >> 8 goto loop
If I try this code:
Then it does not flash in a nicely random way.Code:loop: random temp temp = temp >> 8 toggle LED pause temp goto loop
So... the seed must not be modified.
But anyway this still does not explain why my morse code flasher doesn't work. Unfortunately I do not have the circuit at hand (it's in Paris now) so have to probably build a second one to really test.
Last edited by eggman; - 21st May 2009 at 20:27.
What about using your adcin 'audio' value as the seed - it seems like it should give you some randomness.
+-------------------------------------------------------------------+
| PBP 2.47/2.50 | MCS+ 3.0.0.5 | U2 Prog | Vista x64 | NO SLEEP!!!!!!! |
+-------------------------------------------------------------------+
Bookmarks