summaryrefslogtreecommitdiff
path: root/src/rand.c
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-12-08 09:21:32 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-12-08 09:21:32 -0700
commitb5ad184c1bcef78e7c2b052bcffc71f4c7381bcb (patch)
treef060afc8dc7e896ad48731b58b5414b4c6ab627b /src/rand.c
parentb8c662456f2caf219de2a21f137f8fd61e34b0b2 (diff)
downloadcmath-b5ad184c1bcef78e7c2b052bcffc71f4c7381bcb.tar.gz
cmath-b5ad184c1bcef78e7c2b052bcffc71f4c7381bcb.zip
hw8 checkpoint
Diffstat (limited to 'src/rand.c')
-rw-r--r--src/rand.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rand.c b/src/rand.c
new file mode 100644
index 0000000..ff375ed
--- /dev/null
+++ b/src/rand.c
@@ -0,0 +1,7 @@
+#include "lizfcm.h"
+
+double rand_from(double min, double max) {
+ double range = (max - min);
+ double div = RAND_MAX / range;
+ return min + (rand() / div);
+}