@@ -39,7 +39,7 @@ pub const Random = struct {
39
39
return r .int (u1 ) != 0 ;
40
40
}
41
41
42
- /// Returns a random int `i` such that `0 <= i <= @maxValue (T)`.
42
+ /// Returns a random int `i` such that `0 <= i <= std.math.maxInt (T)`.
43
43
/// `i` is evenly distributed.
44
44
pub fn int (r : * Random , comptime T : type ) T {
45
45
const UnsignedT = @IntType (false , T .bit_count );
@@ -69,14 +69,14 @@ pub const Random = struct {
69
69
assert (T .is_signed == false );
70
70
assert (0 < less_than );
71
71
72
- const last_group_size_minus_one : T = @maxValue (T ) % less_than ;
72
+ const last_group_size_minus_one : T = std . math . maxInt (T ) % less_than ;
73
73
if (last_group_size_minus_one == less_than - 1 ) {
74
74
// less_than is a power of two.
75
75
assert (math .floorPowerOfTwo (T , less_than ) == less_than );
76
- // There is no retry zone. The optimal retry_zone_start would be @maxValue (T) + 1.
76
+ // There is no retry zone. The optimal retry_zone_start would be std.math.maxInt (T) + 1.
77
77
return r .int (T ) % less_than ;
78
78
}
79
- const retry_zone_start = @maxValue (T ) - last_group_size_minus_one ;
79
+ const retry_zone_start = std . math . maxInt (T ) - last_group_size_minus_one ;
80
80
81
81
while (true ) {
82
82
const rand_val = r .int (T );
@@ -91,7 +91,7 @@ pub const Random = struct {
91
91
/// for commentary on the runtime of this function.
92
92
pub fn uintAtMost (r : * Random , comptime T : type , at_most : T ) T {
93
93
assert (T .is_signed == false );
94
- if (at_most == @maxValue (T )) {
94
+ if (at_most == std . math . maxInt (T )) {
95
95
// have the full range
96
96
return r .int (T );
97
97
}
0 commit comments