mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Init random seed with time in simulator main
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "layout.h"
|
||||
#endif
|
||||
#include "telemetry.h"
|
||||
#include "random.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ion.h>
|
||||
@@ -59,6 +60,8 @@ void init() {
|
||||
return;
|
||||
}
|
||||
|
||||
Random::init();
|
||||
|
||||
sWindow = SDL_CreateWindow(
|
||||
"Epsilon",
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#include <ion.h>
|
||||
#include "random.h"
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
void Ion::Simulator::Random::init() {
|
||||
// Set the seed for random using the current time
|
||||
srand(time(NULL));
|
||||
}
|
||||
|
||||
uint32_t Ion::random() {
|
||||
/* rand() returns a pseudo-random integral number in the range between 0 and
|
||||
|
||||
16
ion/src/simulator/shared/random.h
Normal file
16
ion/src/simulator/shared/random.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef ION_SIMULATOR_RANDOM_H
|
||||
#define ION_SIMULATOR_RANDOM_H
|
||||
|
||||
#include <ion.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
namespace Random {
|
||||
|
||||
void init();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user