2024-03-26 13:26:22 +08:00
|
|
|
|
|
|
|
#include "rand.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
double rand_Double01() {
|
|
|
|
// Very bad implementation.
|
|
|
|
return ((double)rand()) / (double)RAND_MAX;
|
|
|
|
}
|
2024-03-26 13:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
double rand_DoubleRange(double min, double max) {
|
|
|
|
return min + rand_Double01() * (max - min);
|
|
|
|
}
|