Numworks Epsilon  1.4.1
Graphing Calculator Operating System
random.cpp
Go to the documentation of this file.
1 #include <ion.h>
2 #include <stdlib.h>
3 
5  /* rand() returns a pseudo-random integral number in the range between 0 and
6  * RAND_MAX. We assert that RAND_MAX is at least 8 bit, this way we can merge
7  * four rand() calls to create a single 32 bit value. Merging is done using
8  * XOR, whose output is as likely to be a 1 as a 0. */
9  static_assert(RAND_MAX >= (1<<8), "RAND_MAX is too small");
10  return (rand() << 24) ^ (rand() << 16) ^ (rand() << 8) ^ rand();
11 }
uint32_t random()
Definition: device.cpp:52
unsigned int uint32_t
Definition: stdint.h:6