Understanding the language, error messages, etc.
by rodot » Thu May 22, 2014 10:28 am
Mmh, I will include a random seed picker function in the library, that's a good idea.
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by rodot » Wed May 28, 2014 5:32 pm
Hey guys,
I just added a new pickRandomSeed() function which should be called just after gb.begin();
It's a mix of the battery voltage, the ambiant light and the time elapsed, which depends on how long does the user take to press 'A' to skip the start menu. It works fine with the emulator.
Here is what it does:
- Code: Select all
randomSeed(battery.voltage * ~micros() + backlight.ambientLight + micros());
As there is a multiplication of 2 pretty large numbers it should overflow several times and give a random random seed ("random random", haha).
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by FreddyBoubil » Fri Jun 20, 2014 8:40 am
Just saw this, thanks a lot !
-
FreddyBoubil
-
- Posts: 9
- Joined: Fri Mar 28, 2014 1:49 pm
- Location: France
Return to Programming Questions
Who is online
Users browsing this forum: No registered users and 2 guests