mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[ion] Correct random() implementation in simulator, blackbox and
emscripten
This commit is contained in:
committed by
EmilieNumworks
parent
84b52fa090
commit
7aca44812e
@@ -11,6 +11,7 @@ objs += $(addprefix ion/src/shared/, \
|
||||
crc32.o \
|
||||
events.o \
|
||||
power.o \
|
||||
random.o \
|
||||
dummy/backlight.o \
|
||||
dummy/battery.o \
|
||||
dummy/events_modifier.o \
|
||||
@@ -24,7 +25,6 @@ objs += $(addprefix ion/src/shared/, \
|
||||
ion/src/shared/log_printf.o: SFLAGS=-Iion/include
|
||||
ion/src/shared/console_stdio.o: SFLAGS=-Iion/include
|
||||
ion/src/shared/events_stdin.o: SFLAGS=-Iion/include
|
||||
ion/src/shared/random.o: SFLAGS=-Iion/include
|
||||
|
||||
SFLAGS += `libpng-config --cflags`
|
||||
LDFLAGS += `libpng-config --ldflags`
|
||||
|
||||
@@ -9,6 +9,7 @@ objs += $(addprefix ion/src/shared/, \
|
||||
events.o \
|
||||
events_modifier.o \
|
||||
power.o \
|
||||
random.o \
|
||||
dummy/backlight.o \
|
||||
dummy/battery.o \
|
||||
dummy/fcc_id.o \
|
||||
|
||||
@@ -2,5 +2,11 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
uint32_t Ion::random() {
|
||||
return rand();
|
||||
/* rand() returns a pseudo-random integral number in the range between 0 and
|
||||
* RAND_MAX which is garantueed to be at least 32767.*/
|
||||
uint32_t result = 0;
|
||||
for (int i = 0; i < 131077; i++) {
|
||||
result += rand();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user