aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/std/rand.zig4
-rw-r--r--lib/std/rand/ziggurat.zig4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/std/rand.zig b/lib/std/rand.zig
index 5b4655bc5d..299d87d39c 100644
--- a/lib/std/rand.zig
+++ b/lib/std/rand.zig
@@ -1123,3 +1123,7 @@ fn testRangeBias(r: *Random, start: i8, end: i8, biased: bool) void {
}
}
}
+
+test "" {
+ std.meta.refAllDecls(@This());
+}
diff --git a/lib/std/rand/ziggurat.zig b/lib/std/rand/ziggurat.zig
index c29d3eeb2b..06728f170c 100644
--- a/lib/std/rand/ziggurat.zig
+++ b/lib/std/rand/ziggurat.zig
@@ -16,8 +16,8 @@ pub fn next_f64(random: *Random, comptime tables: ZigTable) f64 {
while (true) {
// We manually construct a float from parts as we can avoid an extra random lookup here by
// using the unused exponent for the lookup table entry.
- const bits = random.scalar(u64);
- const i = @as(usize, bits & 0xff);
+ const bits = random.int(u64);
+ const i = @as(usize, @truncate(u8, bits));
const u = blk: {
if (tables.is_symmetric) {