aboutsummaryrefslogtreecommitdiff
path: root/src/rnd.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2020-01-15 18:36:25 +1100
committerDavid Timber <mieabby@gmail.com>2020-01-15 18:45:50 +1100
commita9762b186c68797c19c61bf0284a80d9bc51a2ca (patch)
treee1aa87bac8d8605ec3c5f069e1bc83dc2048fbfe /src/rnd.c
parentf97fd125b9e2f8ff27da61a882c50ce66cc79d2d (diff)
unexpand
Diffstat (limited to 'src/rnd.c')
-rw-r--r--src/rnd.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/rnd.c b/src/rnd.c
index b44b07e..09aedf7 100644
--- a/src/rnd.c
+++ b/src/rnd.c
@@ -99,23 +99,23 @@ double prne_rnd_gen_double (prne_rnd_engine_t *engine) {
prne_rnd_engine_t *prne_mk_rnd_engine (void) {
uint32_t seed = 0;
- prne_rnd_engnie_alloc_result_t ret;
-
- getrandom(&seed, sizeof(uint32_t), 0);
-
- if (seed == 0) {
- // fall back to seeding with what's available.
- seed =
- (uint32_t)(time(NULL) % 0xFFFFFFFF) ^
- (uint32_t)(getpid() % 0xFFFFFFFF) ^
- (uint32_t)(getppid() % 0xFFFFFFFF) ^
- (uint32_t)(clock() % 0xFFFFFFFF);
- }
-
- ret = prne_alloc_rnd_engine(seed == 0 ? NULL : &seed);
- if (ret.result != PRNE_RND_ENGINE_ALLOC_OK) {
- return NULL;
- }
-
- return ret.engine;
+ prne_rnd_engnie_alloc_result_t ret;
+
+ getrandom(&seed, sizeof(uint32_t), 0);
+
+ if (seed == 0) {
+ // fall back to seeding with what's available.
+ seed =
+ (uint32_t)(time(NULL) % 0xFFFFFFFF) ^
+ (uint32_t)(getpid() % 0xFFFFFFFF) ^
+ (uint32_t)(getppid() % 0xFFFFFFFF) ^
+ (uint32_t)(clock() % 0xFFFFFFFF);
+ }
+
+ ret = prne_alloc_rnd_engine(seed == 0 ? NULL : &seed);
+ if (ret.result != PRNE_RND_ENGINE_ALLOC_OK) {
+ return NULL;
+ }
+
+ return ret.engine;
}