Function GetTrueRandomSeed
Jump to navigation
Jump to search
Prototype |
|
---|---|
Description |
Obtain a truly random integer generated upon startup. This value is generated only once and should serve to seed a pseudo-random number generator function. The functionn uses the inherent entropy caused by the jitter of the ATmega644 internal watchdog timer RC timer vs the system's crystal. To be able to use this function, you must add "-DTRUE_RANDOM_GEN=1" compile switch to you makefile's KERNEL_OPTIONS variable. The generation of the random seed requires the use of the watchdog timer interrupt, which is only emulated in Uzem V1.3 and up. (Previous version of Uzem will hang if used). |
Parameters |
None |
Returns |
Random seed generated only once at system's startup. |
Video Modes |
N/A |
Since |
V3.3 |
Example:
int main(){ srand(GetTrueRandomSeed()); ... //a truly random value will now be generated! int r=rand(); ... return 0; }