zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 44ff55091f1e851484e04e87d1f36d6662e80af0 (tree)
parent 6b2274fd994edfd26db49d4a2599bbace881fd7a
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat, 18 Apr 2020 14:42:49 -0400

Merge branch 'cshenton-patch-1'

closes #5085

Diffstat:
Mlib/std/rand.zig | 4++++
Mlib/std/rand/ziggurat.zig | 4++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 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 @@ -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) {