Commit b9a7554eba6be5f8fb9a4c2b5051cdc2f0823fea

Thomas de Grivel 2023-12-18T16:53:25

f32_random

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/libc3/f32.c b/libc3/f32.c
index f044402..ba2df54 100644
--- a/libc3/f32.c
+++ b/libc3/f32.c
@@ -86,8 +86,9 @@ f32 * f32_init_copy (f32 *x, const f32 *src)
 f32 * f32_random (f32 *x)
 {
   u32 i;
-  const u32 max = (1 << 24) - 1;
-  u32_random_uniform(&i, max);
+  const u32 max = ((u32) 1 << 24) - 1;
+  u32_random(&i);
+  i &= max;
   *x = (f32) i / max;
   return x;
 }