From a186bcf22b0cb4243f937cabdba639e1abde14e9 Mon Sep 17 00:00:00 2001 From: IOKG04 Date: Thu, 18 Sep 2025 16:09:38 +0200 Subject: [PATCH] replace assertions with comptime assertions also I'll take this commit message to note that these tests aren't perfect, some goodness of fit test like for the normal `float` function would be better, but this should still catch any *big* mistake done in implementation. --- lib/std/Random/ziggurat.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/Random/ziggurat.zig b/lib/std/Random/ziggurat.zig index 501597b795..6c670fe4a4 100644 --- a/lib/std/Random/ziggurat.zig +++ b/lib/std/Random/ziggurat.zig @@ -58,7 +58,7 @@ pub fn next(comptime T: type, random: Random, comptime tables: Table(T)) T { } pub fn Table(comptime T: type) type { - std.debug.assert(@typeInfo(T) == .float); + comptime std.debug.assert(@typeInfo(T) == .float); return struct { x: [257]T, f: [257]T, @@ -105,7 +105,7 @@ pub fn tableGen( /// Namespace containing distributions for a specific floating point type. pub fn distributions(comptime T: type) type { - std.debug.assert(@typeInfo(T) == .float); + comptime std.debug.assert(@typeInfo(T) == .float); return struct { pub const norm_r = 3.6541528853610088; pub const norm_v = 0.00492867323399;