Very bad randomness
This commit is contained in:
9
util/rand.c
Normal file
9
util/rand.c
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
#include "rand.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
double rand_Double01() {
|
||||
// Very bad implementation.
|
||||
return ((double)rand()) / (double)RAND_MAX;
|
||||
}
|
12
util/rand.h
Normal file
12
util/rand.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// returns a double in the [0,1) range.
|
||||
double rand_Double01();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user