Skip to content

Commit

Permalink
Fix random enumValue issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrico01 authored Nov 6, 2024
1 parent 7ebfc72 commit a66d26f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/Random.zig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty
const values = comptime std.enums.values(EnumType);
comptime assert(values.len > 0); // can't return anything
comptime assert(maxInt(Index) >= values.len - 1); // can't access all values
comptime if (values.len == 1) return values[0];
if (values.len == 1) return values[0];

const index = if (comptime values.len - 1 == maxInt(Index))
r.int(Index)
Expand Down

0 comments on commit a66d26f

Please sign in to comment.