| author | |
| committer | |
| log | 8d56e472c9fa97dc6eeae9866eed927910f7dfe2 |
| tree | 76886b87aee7e499e51b9852701c4ebb75dd135d |
| parent | 9af077d71eaf2c004d63405fc5c017e237cb9c6c |
34 files changed, 71 insertions(+), 79 deletions(-)
lib/build_runner.zig+2-2| ... | @@ -420,7 +420,7 @@ fn runStepNames( | ... | @@ -420,7 +420,7 @@ fn runStepNames( |
| 420 | 420 | ||
| 421 | const starting_steps = try arena.dupe(*Step, step_stack.keys()); | 421 | const starting_steps = try arena.dupe(*Step, step_stack.keys()); |
| 422 | 422 | ||
| 423 | var rng = std.rand.DefaultPrng.init(seed); | 423 | var rng = std.Random.DefaultPrng.init(seed); |
| 424 | const rand = rng.random(); | 424 | const rand = rng.random(); |
| 425 | rand.shuffle(*Step, starting_steps); | 425 | rand.shuffle(*Step, starting_steps); |
| 426 | 426 | ||
| ... | @@ -836,7 +836,7 @@ fn constructGraphAndCheckForDependencyLoop( | ... | @@ -836,7 +836,7 @@ fn constructGraphAndCheckForDependencyLoop( |
| 836 | b: *std.Build, | 836 | b: *std.Build, |
| 837 | s: *Step, | 837 | s: *Step, |
| 838 | step_stack: *std.AutoArrayHashMapUnmanaged(*Step, void), | 838 | step_stack: *std.AutoArrayHashMapUnmanaged(*Step, void), |
| 839 | rand: std.rand.Random, | 839 | rand: std.Random, |
| 840 | ) !void { | 840 | ) !void { |
| 841 | switch (s.state) { | 841 | switch (s.state) { |
| 842 | .precheck_started => { | 842 | .precheck_started => { |
lib/compiler_rt/paritydi2_test.zig+1-1| ... | @@ -26,7 +26,7 @@ test "paritydi2" { | ... | @@ -26,7 +26,7 @@ test "paritydi2" { |
| 26 | try test__paritydi2(@bitCast(@as(u64, 0xffffffff_fffffffe))); | 26 | try test__paritydi2(@bitCast(@as(u64, 0xffffffff_fffffffe))); |
| 27 | try test__paritydi2(@bitCast(@as(u64, 0xffffffff_ffffffff))); | 27 | try test__paritydi2(@bitCast(@as(u64, 0xffffffff_ffffffff))); |
| 28 | 28 | ||
| 29 | const RndGen = std.rand.DefaultPrng; | 29 | const RndGen = std.Random.DefaultPrng; |
| 30 | var rnd = RndGen.init(42); | 30 | var rnd = RndGen.init(42); |
| 31 | var i: u32 = 0; | 31 | var i: u32 = 0; |
| 32 | while (i < 10_000) : (i += 1) { | 32 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/paritysi2_test.zig+1-1| ... | @@ -26,7 +26,7 @@ test "paritysi2" { | ... | @@ -26,7 +26,7 @@ test "paritysi2" { |
| 26 | try test__paritysi2(@bitCast(@as(u32, 0xfffffffe))); | 26 | try test__paritysi2(@bitCast(@as(u32, 0xfffffffe))); |
| 27 | try test__paritysi2(@bitCast(@as(u32, 0xffffffff))); | 27 | try test__paritysi2(@bitCast(@as(u32, 0xffffffff))); |
| 28 | 28 | ||
| 29 | const RndGen = std.rand.DefaultPrng; | 29 | const RndGen = std.Random.DefaultPrng; |
| 30 | var rnd = RndGen.init(42); | 30 | var rnd = RndGen.init(42); |
| 31 | var i: u32 = 0; | 31 | var i: u32 = 0; |
| 32 | while (i < 10_000) : (i += 1) { | 32 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/parityti2_test.zig+1-1| ... | @@ -26,7 +26,7 @@ test "parityti2" { | ... | @@ -26,7 +26,7 @@ test "parityti2" { |
| 26 | try test__parityti2(@bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe))); | 26 | try test__parityti2(@bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe))); |
| 27 | try test__parityti2(@bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff))); | 27 | try test__parityti2(@bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff))); |
| 28 | 28 | ||
| 29 | const RndGen = std.rand.DefaultPrng; | 29 | const RndGen = std.Random.DefaultPrng; |
| 30 | var rnd = RndGen.init(42); | 30 | var rnd = RndGen.init(42); |
| 31 | var i: u32 = 0; | 31 | var i: u32 = 0; |
| 32 | while (i < 10_000) : (i += 1) { | 32 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/popcountdi2_test.zig+1-1| ... | @@ -25,7 +25,7 @@ test "popcountdi2" { | ... | @@ -25,7 +25,7 @@ test "popcountdi2" { |
| 25 | try test__popcountdi2(@as(i64, @bitCast(@as(u64, 0xffffffff_fffffffe)))); | 25 | try test__popcountdi2(@as(i64, @bitCast(@as(u64, 0xffffffff_fffffffe)))); |
| 26 | try test__popcountdi2(@as(i64, @bitCast(@as(u64, 0xffffffff_ffffffff)))); | 26 | try test__popcountdi2(@as(i64, @bitCast(@as(u64, 0xffffffff_ffffffff)))); |
| 27 | 27 | ||
| 28 | const RndGen = std.rand.DefaultPrng; | 28 | const RndGen = std.Random.DefaultPrng; |
| 29 | var rnd = RndGen.init(42); | 29 | var rnd = RndGen.init(42); |
| 30 | var i: u32 = 0; | 30 | var i: u32 = 0; |
| 31 | while (i < 10_000) : (i += 1) { | 31 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/popcountsi2_test.zig+1-1| ... | @@ -25,7 +25,7 @@ test "popcountsi2" { | ... | @@ -25,7 +25,7 @@ test "popcountsi2" { |
| 25 | try test__popcountsi2(@as(i32, @bitCast(@as(u32, 0xfffffffe)))); | 25 | try test__popcountsi2(@as(i32, @bitCast(@as(u32, 0xfffffffe)))); |
| 26 | try test__popcountsi2(@as(i32, @bitCast(@as(u32, 0xffffffff)))); | 26 | try test__popcountsi2(@as(i32, @bitCast(@as(u32, 0xffffffff)))); |
| 27 | 27 | ||
| 28 | const RndGen = std.rand.DefaultPrng; | 28 | const RndGen = std.Random.DefaultPrng; |
| 29 | var rnd = RndGen.init(42); | 29 | var rnd = RndGen.init(42); |
| 30 | var i: u32 = 0; | 30 | var i: u32 = 0; |
| 31 | while (i < 10_000) : (i += 1) { | 31 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/popcountti2_test.zig+1-1| ... | @@ -25,7 +25,7 @@ test "popcountti2" { | ... | @@ -25,7 +25,7 @@ test "popcountti2" { |
| 25 | try test__popcountti2(@as(i128, @bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)))); | 25 | try test__popcountti2(@as(i128, @bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)))); |
| 26 | try test__popcountti2(@as(i128, @bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)))); | 26 | try test__popcountti2(@as(i128, @bitCast(@as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)))); |
| 27 | 27 | ||
| 28 | const RndGen = std.rand.DefaultPrng; | 28 | const RndGen = std.Random.DefaultPrng; |
| 29 | var rnd = RndGen.init(42); | 29 | var rnd = RndGen.init(42); |
| 30 | var i: u32 = 0; | 30 | var i: u32 = 0; |
| 31 | while (i < 10_000) : (i += 1) { | 31 | while (i < 10_000) : (i += 1) { |
lib/compiler_rt/udivmodei4.zig+1-1| ... | @@ -132,7 +132,7 @@ test "__udivei4/__umodei4" { | ... | @@ -132,7 +132,7 @@ test "__udivei4/__umodei4" { |
| 132 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 132 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 133 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 133 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 134 | 134 | ||
| 135 | const RndGen = std.rand.DefaultPrng; | 135 | const RndGen = std.Random.DefaultPrng; |
| 136 | var rnd = RndGen.init(42); | 136 | var rnd = RndGen.init(42); |
| 137 | var i: usize = 10000; | 137 | var i: usize = 10000; |
| 138 | while (i > 0) : (i -= 1) { | 138 | while (i > 0) : (i -= 1) { |
lib/std/Random.zig+1-1| ... | @@ -380,7 +380,7 @@ pub fn shuffleWithIndex(r: Random, comptime T: type, buf: []T, comptime Index: t | ... | @@ -380,7 +380,7 @@ pub fn shuffleWithIndex(r: Random, comptime T: type, buf: []T, comptime Index: t |
| 380 | /// | 380 | /// |
| 381 | /// This is useful for selecting an item from a slice where weights are not equal. | 381 | /// This is useful for selecting an item from a slice where weights are not equal. |
| 382 | /// `T` must be a numeric type capable of holding the sum of `proportions`. | 382 | /// `T` must be a numeric type capable of holding the sum of `proportions`. |
| 383 | pub fn weightedIndex(r: std.rand.Random, comptime T: type, proportions: []const T) usize { | 383 | pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize { |
| 384 | // This implementation works by summing the proportions and picking a | 384 | // This implementation works by summing the proportions and picking a |
| 385 | // random point in [0, sum). We then loop over the proportions, | 385 | // random point in [0, sum). We then loop over the proportions, |
| 386 | // accumulating until our accumulator is greater than the random point. | 386 | // accumulating until our accumulator is greater than the random point. |
lib/std/Random/Ascon.zig+3-4| ... | @@ -10,7 +10,6 @@ | ... | @@ -10,7 +10,6 @@ |
| 10 | 10 | ||
| 11 | const std = @import("std"); | 11 | const std = @import("std"); |
| 12 | const mem = std.mem; | 12 | const mem = std.mem; |
| 13 | const Random = std.rand.Random; | ||
| 14 | const Self = @This(); | 13 | const Self = @This(); |
| 15 | 14 | ||
| 16 | const Ascon = std.crypto.core.Ascon(.little); | 15 | const Ascon = std.crypto.core.Ascon(.little); |
| ... | @@ -39,9 +38,9 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void { | ... | @@ -39,9 +38,9 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void { |
| 39 | self.state.permute(); | 38 | self.state.permute(); |
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | /// Returns a `std.rand.Random` structure backed by the current RNG. | 41 | /// Returns a `std.Random` structure backed by the current RNG. |
| 43 | pub fn random(self: *Self) Random { | 42 | pub fn random(self: *Self) std.Random { |
| 44 | return Random.init(self, fill); | 43 | return std.Random.init(self, fill); |
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | /// Fills the buffer with random bytes. | 46 | /// Fills the buffer with random bytes. |
lib/std/Random/ChaCha.zig+3-4| ... | @@ -5,7 +5,6 @@ | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | ||
| 6 | const std = @import("std"); | 6 | const std = @import("std"); |
| 7 | const mem = std.mem; | 7 | const mem = std.mem; |
| 8 | const Random = std.rand.Random; | ||
| 9 | const Self = @This(); | 8 | const Self = @This(); |
| 10 | 9 | ||
| 11 | const Cipher = std.crypto.stream.chacha.ChaCha8IETF; | 10 | const Cipher = std.crypto.stream.chacha.ChaCha8IETF; |
| ... | @@ -53,9 +52,9 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void { | ... | @@ -53,9 +52,9 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void { |
| 53 | self.refill(); | 52 | self.refill(); |
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | /// Returns a `std.rand.Random` structure backed by the current RNG. | 55 | /// Returns a `std.Random` structure backed by the current RNG. |
| 57 | pub fn random(self: *Self) Random { | 56 | pub fn random(self: *Self) std.Random { |
| 58 | return Random.init(self, fill); | 57 | return std.Random.init(self, fill); |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | // Refills the buffer with random bytes, overwriting the previous key. | 60 | // Refills the buffer with random bytes, overwriting the previous key. |
lib/std/Random/Isaac64.zig+2-3| ... | @@ -4,7 +4,6 @@ | ... | @@ -4,7 +4,6 @@ |
| 4 | //! https://doc.rust-lang.org/rand/src/rand/prng/isaac64.rs.html | 4 | //! https://doc.rust-lang.org/rand/src/rand/prng/isaac64.rs.html |
| 5 | 5 | ||
| 6 | const std = @import("std"); | 6 | const std = @import("std"); |
| 7 | const Random = std.rand.Random; | ||
| 8 | const mem = std.mem; | 7 | const mem = std.mem; |
| 9 | const Isaac64 = @This(); | 8 | const Isaac64 = @This(); |
| 10 | 9 | ||
| ... | @@ -30,8 +29,8 @@ pub fn init(init_s: u64) Isaac64 { | ... | @@ -30,8 +29,8 @@ pub fn init(init_s: u64) Isaac64 { |
| 30 | return isaac; | 29 | return isaac; |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | pub fn random(self: *Isaac64) Random { | 32 | pub fn random(self: *Isaac64) std.Random { |
| 34 | return Random.init(self, fill); | 33 | return std.Random.init(self, fill); |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | fn step(self: *Isaac64, mix: u64, base: usize, comptime m1: usize, comptime m2: usize) void { | 36 | fn step(self: *Isaac64, mix: u64, base: usize, comptime m1: usize, comptime m2: usize) void { |
lib/std/Random/Pcg.zig+3-4| ... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
| 3 | //! PRNG | 3 | //! PRNG |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Random = std.rand.Random; | ||
| 7 | const Pcg = @This(); | 6 | const Pcg = @This(); |
| 8 | 7 | ||
| 9 | const default_multiplier = 6364136223846793005; | 8 | const default_multiplier = 6364136223846793005; |
| ... | @@ -21,8 +20,8 @@ pub fn init(init_s: u64) Pcg { | ... | @@ -21,8 +20,8 @@ pub fn init(init_s: u64) Pcg { |
| 21 | return pcg; | 20 | return pcg; |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | pub fn random(self: *Pcg) Random { | 23 | pub fn random(self: *Pcg) std.Random { |
| 25 | return Random.init(self, fill); | 24 | return std.Random.init(self, fill); |
| 26 | } | 25 | } |
| 27 | 26 | ||
| 28 | fn next(self: *Pcg) u32 { | 27 | fn next(self: *Pcg) u32 { |
| ... | @@ -37,7 +36,7 @@ fn next(self: *Pcg) u32 { | ... | @@ -37,7 +36,7 @@ fn next(self: *Pcg) u32 { |
| 37 | 36 | ||
| 38 | fn seed(self: *Pcg, init_s: u64) void { | 37 | fn seed(self: *Pcg, init_s: u64) void { |
| 39 | // Pcg requires 128-bits of seed. | 38 | // Pcg requires 128-bits of seed. |
| 40 | var gen = std.rand.SplitMix64.init(init_s); | 39 | var gen = std.Random.SplitMix64.init(init_s); |
| 41 | self.seedTwo(gen.next(), gen.next()); | 40 | self.seedTwo(gen.next(), gen.next()); |
| 42 | } | 41 | } |
| 43 | 42 |
lib/std/Random/RomuTrio.zig+3-4| ... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
| 3 | // Beware: this PRNG is trivially predictable. While fast, it should *never* be used for cryptographic purposes. | 3 | // Beware: this PRNG is trivially predictable. While fast, it should *never* be used for cryptographic purposes. |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Random = std.rand.Random; | ||
| 7 | const math = std.math; | 6 | const math = std.math; |
| 8 | const RomuTrio = @This(); | 7 | const RomuTrio = @This(); |
| 9 | 8 | ||
| ... | @@ -17,8 +16,8 @@ pub fn init(init_s: u64) RomuTrio { | ... | @@ -17,8 +16,8 @@ pub fn init(init_s: u64) RomuTrio { |
| 17 | return x; | 16 | return x; |
| 18 | } | 17 | } |
| 19 | 18 | ||
| 20 | pub fn random(self: *RomuTrio) Random { | 19 | pub fn random(self: *RomuTrio) std.Random { |
| 21 | return Random.init(self, fill); | 20 | return std.Random.init(self, fill); |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | fn next(self: *RomuTrio) u64 { | 23 | fn next(self: *RomuTrio) u64 { |
| ... | @@ -42,7 +41,7 @@ pub fn seedWithBuf(self: *RomuTrio, buf: [24]u8) void { | ... | @@ -42,7 +41,7 @@ pub fn seedWithBuf(self: *RomuTrio, buf: [24]u8) void { |
| 42 | 41 | ||
| 43 | pub fn seed(self: *RomuTrio, init_s: u64) void { | 42 | pub fn seed(self: *RomuTrio, init_s: u64) void { |
| 44 | // RomuTrio requires 192-bits of seed. | 43 | // RomuTrio requires 192-bits of seed. |
| 45 | var gen = std.rand.SplitMix64.init(init_s); | 44 | var gen = std.Random.SplitMix64.init(init_s); |
| 46 | 45 | ||
| 47 | self.x_state = gen.next(); | 46 | self.x_state = gen.next(); |
| 48 | self.y_state = gen.next(); | 47 | self.y_state = gen.next(); |
lib/std/Random/Sfc64.zig+2-3| ... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
| 3 | //! See http://pracrand.sourceforge.net/ | 3 | //! See http://pracrand.sourceforge.net/ |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Random = std.rand.Random; | ||
| 7 | const math = std.math; | 6 | const math = std.math; |
| 8 | const Sfc64 = @This(); | 7 | const Sfc64 = @This(); |
| 9 | 8 | ||
| ... | @@ -23,8 +22,8 @@ pub fn init(init_s: u64) Sfc64 { | ... | @@ -23,8 +22,8 @@ pub fn init(init_s: u64) Sfc64 { |
| 23 | return x; | 22 | return x; |
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | pub fn random(self: *Sfc64) Random { | 25 | pub fn random(self: *Sfc64) std.Random { |
| 27 | return Random.init(self, fill); | 26 | return std.Random.init(self, fill); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | fn next(self: *Sfc64) u64 { | 29 | fn next(self: *Sfc64) u64 { |
lib/std/Random/Xoroshiro128.zig+3-4| ... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
| 3 | //! PRNG | 3 | //! PRNG |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Random = std.rand.Random; | ||
| 7 | const math = std.math; | 6 | const math = std.math; |
| 8 | const Xoroshiro128 = @This(); | 7 | const Xoroshiro128 = @This(); |
| 9 | 8 | ||
| ... | @@ -16,8 +15,8 @@ pub fn init(init_s: u64) Xoroshiro128 { | ... | @@ -16,8 +15,8 @@ pub fn init(init_s: u64) Xoroshiro128 { |
| 16 | return x; | 15 | return x; |
| 17 | } | 16 | } |
| 18 | 17 | ||
| 19 | pub fn random(self: *Xoroshiro128) Random { | 18 | pub fn random(self: *Xoroshiro128) std.Random { |
| 20 | return Random.init(self, fill); | 19 | return std.Random.init(self, fill); |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | pub fn next(self: *Xoroshiro128) u64 { | 22 | pub fn next(self: *Xoroshiro128) u64 { |
| ... | @@ -59,7 +58,7 @@ pub fn jump(self: *Xoroshiro128) void { | ... | @@ -59,7 +58,7 @@ pub fn jump(self: *Xoroshiro128) void { |
| 59 | 58 | ||
| 60 | pub fn seed(self: *Xoroshiro128, init_s: u64) void { | 59 | pub fn seed(self: *Xoroshiro128, init_s: u64) void { |
| 61 | // Xoroshiro requires 128-bits of seed. | 60 | // Xoroshiro requires 128-bits of seed. |
| 62 | var gen = std.rand.SplitMix64.init(init_s); | 61 | var gen = std.Random.SplitMix64.init(init_s); |
| 63 | 62 | ||
| 64 | self.s[0] = gen.next(); | 63 | self.s[0] = gen.next(); |
| 65 | self.s[1] = gen.next(); | 64 | self.s[1] = gen.next(); |
lib/std/Random/Xoshiro256.zig+3-4| ... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
| 3 | //! PRNG | 3 | //! PRNG |
| 4 | 4 | ||
| 5 | const std = @import("std"); | 5 | const std = @import("std"); |
| 6 | const Random = std.rand.Random; | ||
| 7 | const math = std.math; | 6 | const math = std.math; |
| 8 | const Xoshiro256 = @This(); | 7 | const Xoshiro256 = @This(); |
| 9 | 8 | ||
| ... | @@ -18,8 +17,8 @@ pub fn init(init_s: u64) Xoshiro256 { | ... | @@ -18,8 +17,8 @@ pub fn init(init_s: u64) Xoshiro256 { |
| 18 | return x; | 17 | return x; |
| 19 | } | 18 | } |
| 20 | 19 | ||
| 21 | pub fn random(self: *Xoshiro256) Random { | 20 | pub fn random(self: *Xoshiro256) std.Random { |
| 22 | return Random.init(self, fill); | 21 | return std.Random.init(self, fill); |
| 23 | } | 22 | } |
| 24 | 23 | ||
| 25 | pub fn next(self: *Xoshiro256) u64 { | 24 | pub fn next(self: *Xoshiro256) u64 { |
| ... | @@ -57,7 +56,7 @@ pub fn jump(self: *Xoshiro256) void { | ... | @@ -57,7 +56,7 @@ pub fn jump(self: *Xoshiro256) void { |
| 57 | 56 | ||
| 58 | pub fn seed(self: *Xoshiro256, init_s: u64) void { | 57 | pub fn seed(self: *Xoshiro256, init_s: u64) void { |
| 59 | // Xoshiro requires 256-bits of seed. | 58 | // Xoshiro requires 256-bits of seed. |
| 60 | var gen = std.rand.SplitMix64.init(init_s); | 59 | var gen = std.Random.SplitMix64.init(init_s); |
| 61 | 60 | ||
| 62 | self.s[0] = gen.next(); | 61 | self.s[0] = gen.next(); |
| 63 | self.s[1] = gen.next(); | 62 | self.s[1] = gen.next(); |
lib/std/Random/benchmark.zig+9-9| ... | @@ -4,7 +4,7 @@ const std = @import("std"); | ... | @@ -4,7 +4,7 @@ const std = @import("std"); |
| 4 | const builtin = @import("builtin"); | 4 | const builtin = @import("builtin"); |
| 5 | const time = std.time; | 5 | const time = std.time; |
| 6 | const Timer = time.Timer; | 6 | const Timer = time.Timer; |
| 7 | const rand = std.rand; | 7 | const Random = std.Random; |
| 8 | 8 | ||
| 9 | const KiB = 1024; | 9 | const KiB = 1024; |
| 10 | const MiB = 1024 * KiB; | 10 | const MiB = 1024 * KiB; |
| ... | @@ -19,32 +19,32 @@ const Rng = struct { | ... | @@ -19,32 +19,32 @@ const Rng = struct { |
| 19 | 19 | ||
| 20 | const prngs = [_]Rng{ | 20 | const prngs = [_]Rng{ |
| 21 | Rng{ | 21 | Rng{ |
| 22 | .ty = rand.Isaac64, | 22 | .ty = Random.Isaac64, |
| 23 | .name = "isaac64", | 23 | .name = "isaac64", |
| 24 | .init_u64 = 0, | 24 | .init_u64 = 0, |
| 25 | }, | 25 | }, |
| 26 | Rng{ | 26 | Rng{ |
| 27 | .ty = rand.Pcg, | 27 | .ty = Random.Pcg, |
| 28 | .name = "pcg", | 28 | .name = "pcg", |
| 29 | .init_u64 = 0, | 29 | .init_u64 = 0, |
| 30 | }, | 30 | }, |
| 31 | Rng{ | 31 | Rng{ |
| 32 | .ty = rand.RomuTrio, | 32 | .ty = Random.RomuTrio, |
| 33 | .name = "romutrio", | 33 | .name = "romutrio", |
| 34 | .init_u64 = 0, | 34 | .init_u64 = 0, |
| 35 | }, | 35 | }, |
| 36 | Rng{ | 36 | Rng{ |
| 37 | .ty = std.rand.Sfc64, | 37 | .ty = Random.Sfc64, |
| 38 | .name = "sfc64", | 38 | .name = "sfc64", |
| 39 | .init_u64 = 0, | 39 | .init_u64 = 0, |
| 40 | }, | 40 | }, |
| 41 | Rng{ | 41 | Rng{ |
| 42 | .ty = std.rand.Xoroshiro128, | 42 | .ty = Random.Xoroshiro128, |
| 43 | .name = "xoroshiro128", | 43 | .name = "xoroshiro128", |
| 44 | .init_u64 = 0, | 44 | .init_u64 = 0, |
| 45 | }, | 45 | }, |
| 46 | Rng{ | 46 | Rng{ |
| 47 | .ty = std.rand.Xoshiro256, | 47 | .ty = Random.Xoshiro256, |
| 48 | .name = "xoshiro256", | 48 | .name = "xoshiro256", |
| 49 | .init_u64 = 0, | 49 | .init_u64 = 0, |
| 50 | }, | 50 | }, |
| ... | @@ -52,12 +52,12 @@ const prngs = [_]Rng{ | ... | @@ -52,12 +52,12 @@ const prngs = [_]Rng{ |
| 52 | 52 | ||
| 53 | const csprngs = [_]Rng{ | 53 | const csprngs = [_]Rng{ |
| 54 | Rng{ | 54 | Rng{ |
| 55 | .ty = rand.Ascon, | 55 | .ty = Random.Ascon, |
| 56 | .name = "ascon", | 56 | .name = "ascon", |
| 57 | .init_u8s = &[_]u8{0} ** 32, | 57 | .init_u8s = &[_]u8{0} ** 32, |
| 58 | }, | 58 | }, |
| 59 | Rng{ | 59 | Rng{ |
| 60 | .ty = rand.ChaCha, | 60 | .ty = Random.ChaCha, |
| 61 | .name = "chacha", | 61 | .name = "chacha", |
| 62 | .init_u8s = &[_]u8{0} ** 32, | 62 | .init_u8s = &[_]u8{0} ** 32, |
| 63 | }, | 63 | }, |
lib/std/Random/ziggurat.zig+3-3| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | const std = @import("../std.zig"); | 10 | const std = @import("../std.zig"); |
| 11 | const builtin = @import("builtin"); | 11 | const builtin = @import("builtin"); |
| 12 | const math = std.math; | 12 | const math = std.math; |
| 13 | const Random = std.rand.Random; | 13 | const Random = std.Random; |
| 14 | 14 | ||
| 15 | pub fn next_f64(random: Random, comptime tables: ZigTable) f64 { | 15 | pub fn next_f64(random: Random, comptime tables: ZigTable) f64 { |
| 16 | while (true) { | 16 | while (true) { |
| ... | @@ -127,7 +127,7 @@ pub fn norm_zero_case(random: Random, u: f64) f64 { | ... | @@ -127,7 +127,7 @@ pub fn norm_zero_case(random: Random, u: f64) f64 { |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | test "normal dist sanity" { | 129 | test "normal dist sanity" { |
| 130 | var prng = std.rand.DefaultPrng.init(0); | 130 | var prng = Random.DefaultPrng.init(0); |
| 131 | const random = prng.random(); | 131 | const random = prng.random(); |
| 132 | 132 | ||
| 133 | var i: usize = 0; | 133 | var i: usize = 0; |
| ... | @@ -156,7 +156,7 @@ pub fn exp_zero_case(random: Random, _: f64) f64 { | ... | @@ -156,7 +156,7 @@ pub fn exp_zero_case(random: Random, _: f64) f64 { |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | test "exp dist smoke test" { | 158 | test "exp dist smoke test" { |
| 159 | var prng = std.rand.DefaultPrng.init(0); | 159 | var prng = Random.DefaultPrng.init(0); |
| 160 | const random = prng.random(); | 160 | const random = prng.random(); |
| 161 | 161 | ||
| 162 | var i: usize = 0; | 162 | var i: usize = 0; |
lib/std/Thread/RwLock.zig+1-1| ... | @@ -328,7 +328,7 @@ test "RwLock - concurrent access" { | ... | @@ -328,7 +328,7 @@ test "RwLock - concurrent access" { |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | fn writer(self: *Self, thread_idx: usize) !void { | 330 | fn writer(self: *Self, thread_idx: usize) !void { |
| 331 | var prng = std.rand.DefaultPrng.init(thread_idx); | 331 | var prng = std.Random.DefaultPrng.init(thread_idx); |
| 332 | var rnd = prng.random(); | 332 | var rnd = prng.random(); |
| 333 | 333 | ||
| 334 | while (true) { | 334 | while (true) { |
lib/std/crypto/benchmark.zig+1-1| ... | @@ -10,7 +10,7 @@ const crypto = std.crypto; | ... | @@ -10,7 +10,7 @@ const crypto = std.crypto; |
| 10 | const KiB = 1024; | 10 | const KiB = 1024; |
| 11 | const MiB = 1024 * KiB; | 11 | const MiB = 1024 * KiB; |
| 12 | 12 | ||
| 13 | var prng = std.rand.DefaultPrng.init(0); | 13 | var prng = std.Random.DefaultPrng.init(0); |
| 14 | const random = prng.random(); | 14 | const random = prng.random(); |
| 15 | 15 | ||
| 16 | const Crypto = struct { | 16 | const Crypto = struct { |
lib/std/crypto/kyber_d00.zig+1-1| ... | @@ -110,7 +110,7 @@ const assert = std.debug.assert; | ... | @@ -110,7 +110,7 @@ const assert = std.debug.assert; |
| 110 | const crypto = std.crypto; | 110 | const crypto = std.crypto; |
| 111 | const math = std.math; | 111 | const math = std.math; |
| 112 | const mem = std.mem; | 112 | const mem = std.mem; |
| 113 | const RndGen = std.rand.DefaultPrng; | 113 | const RndGen = std.Random.DefaultPrng; |
| 114 | const sha3 = crypto.hash.sha3; | 114 | const sha3 = crypto.hash.sha3; |
| 115 | 115 | ||
| 116 | // Q is the parameter q ≡ 3329 = 2¹¹ + 2¹⁰ + 2⁸ + 1. | 116 | // Q is the parameter q ≡ 3329 = 2¹¹ + 2¹⁰ + 2⁸ + 1. |
lib/std/crypto/tlcsprng.zig+2-2| ... | @@ -10,7 +10,7 @@ const os = std.os; | ... | @@ -10,7 +10,7 @@ const os = std.os; |
| 10 | 10 | ||
| 11 | /// We use this as a layer of indirection because global const pointers cannot | 11 | /// We use this as a layer of indirection because global const pointers cannot |
| 12 | /// point to thread-local variables. | 12 | /// point to thread-local variables. |
| 13 | pub const interface = std.rand.Random{ | 13 | pub const interface = std.Random{ |
| 14 | .ptr = undefined, | 14 | .ptr = undefined, |
| 15 | .fillFn = tlsCsprngFill, | 15 | .fillFn = tlsCsprngFill, |
| 16 | }; | 16 | }; |
| ... | @@ -43,7 +43,7 @@ const maybe_have_wipe_on_fork = builtin.os.isAtLeast(.linux, .{ | ... | @@ -43,7 +43,7 @@ const maybe_have_wipe_on_fork = builtin.os.isAtLeast(.linux, .{ |
| 43 | }) orelse true; | 43 | }) orelse true; |
| 44 | const is_haiku = builtin.os.tag == .haiku; | 44 | const is_haiku = builtin.os.tag == .haiku; |
| 45 | 45 | ||
| 46 | const Rng = std.rand.DefaultCsprng; | 46 | const Rng = std.Random.DefaultCsprng; |
| 47 | 47 | ||
| 48 | const Context = struct { | 48 | const Context = struct { |
| 49 | init_state: enum(u8) { uninitialized = 0, initialized, failed }, | 49 | init_state: enum(u8) { uninitialized = 0, initialized, failed }, |
lib/std/hash/benchmark.zig+1-1| ... | @@ -10,7 +10,7 @@ const KiB = 1024; | ... | @@ -10,7 +10,7 @@ const KiB = 1024; |
| 10 | const MiB = 1024 * KiB; | 10 | const MiB = 1024 * KiB; |
| 11 | const GiB = 1024 * MiB; | 11 | const GiB = 1024 * MiB; |
| 12 | 12 | ||
| 13 | var prng = std.rand.DefaultPrng.init(0); | 13 | var prng = std.Random.DefaultPrng.init(0); |
| 14 | const random = prng.random(); | 14 | const random = prng.random(); |
| 15 | 15 | ||
| 16 | const Hash = struct { | 16 | const Hash = struct { |
lib/std/hash_map.zig+2-2| ... | @@ -1884,7 +1884,7 @@ test "std.hash_map put and remove loop in random order" { | ... | @@ -1884,7 +1884,7 @@ test "std.hash_map put and remove loop in random order" { |
| 1884 | while (i < size) : (i += 1) { | 1884 | while (i < size) : (i += 1) { |
| 1885 | try keys.append(i); | 1885 | try keys.append(i); |
| 1886 | } | 1886 | } |
| 1887 | var prng = std.rand.DefaultPrng.init(0); | 1887 | var prng = std.Random.DefaultPrng.init(0); |
| 1888 | const random = prng.random(); | 1888 | const random = prng.random(); |
| 1889 | 1889 | ||
| 1890 | while (i < iterations) : (i += 1) { | 1890 | while (i < iterations) : (i += 1) { |
| ... | @@ -1916,7 +1916,7 @@ test "std.hash_map remove one million elements in random order" { | ... | @@ -1916,7 +1916,7 @@ test "std.hash_map remove one million elements in random order" { |
| 1916 | keys.append(i) catch unreachable; | 1916 | keys.append(i) catch unreachable; |
| 1917 | } | 1917 | } |
| 1918 | 1918 | ||
| 1919 | var prng = std.rand.DefaultPrng.init(0); | 1919 | var prng = std.Random.DefaultPrng.init(0); |
| 1920 | const random = prng.random(); | 1920 | const random = prng.random(); |
| 1921 | random.shuffle(u32, keys.items); | 1921 | random.shuffle(u32, keys.items); |
| 1922 | 1922 |
lib/std/heap/arena_allocator.zig+1-1| ... | @@ -250,7 +250,7 @@ test "ArenaAllocator (reset with preheating)" { | ... | @@ -250,7 +250,7 @@ test "ArenaAllocator (reset with preheating)" { |
| 250 | var arena_allocator = ArenaAllocator.init(std.testing.allocator); | 250 | var arena_allocator = ArenaAllocator.init(std.testing.allocator); |
| 251 | defer arena_allocator.deinit(); | 251 | defer arena_allocator.deinit(); |
| 252 | // provides some variance in the allocated data | 252 | // provides some variance in the allocated data |
| 253 | var rng_src = std.rand.DefaultPrng.init(19930913); | 253 | var rng_src = std.Random.DefaultPrng.init(19930913); |
| 254 | const random = rng_src.random(); | 254 | const random = rng_src.random(); |
| 255 | var rounds: usize = 25; | 255 | var rounds: usize = 25; |
| 256 | while (rounds > 0) { | 256 | while (rounds > 0) { |
lib/std/io/test.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const io = std.io; | 2 | const io = std.io; |
| 3 | const DefaultPrng = std.rand.DefaultPrng; | 3 | const DefaultPrng = std.Random.DefaultPrng; |
| 4 | const expect = std.testing.expect; | 4 | const expect = std.testing.expect; |
| 5 | const expectEqual = std.testing.expectEqual; | 5 | const expectEqual = std.testing.expectEqual; |
| 6 | const expectError = std.testing.expectError; | 6 | const expectError = std.testing.expectError; |
lib/std/math/big/rational.zig+1-1| ... | @@ -594,7 +594,7 @@ test "big.rational toFloat" { | ... | @@ -594,7 +594,7 @@ test "big.rational toFloat" { |
| 594 | test "big.rational set/to Float round-trip" { | 594 | test "big.rational set/to Float round-trip" { |
| 595 | var a = try Rational.init(testing.allocator); | 595 | var a = try Rational.init(testing.allocator); |
| 596 | defer a.deinit(); | 596 | defer a.deinit(); |
| 597 | var prng = std.rand.DefaultPrng.init(0x5EED); | 597 | var prng = std.Random.DefaultPrng.init(0x5EED); |
| 598 | const random = prng.random(); | 598 | const random = prng.random(); |
| 599 | var i: usize = 0; | 599 | var i: usize = 0; |
| 600 | while (i < 512) : (i += 1) { | 600 | while (i < 512) : (i += 1) { |
lib/std/mem.zig+1-1| ... | @@ -4423,7 +4423,7 @@ test "read/write(Var)PackedInt" { | ... | @@ -4423,7 +4423,7 @@ test "read/write(Var)PackedInt" { |
| 4423 | 4423 | ||
| 4424 | const foreign_endian: Endian = if (native_endian == .big) .little else .big; | 4424 | const foreign_endian: Endian = if (native_endian == .big) .little else .big; |
| 4425 | const expect = std.testing.expect; | 4425 | const expect = std.testing.expect; |
| 4426 | var prng = std.rand.DefaultPrng.init(1234); | 4426 | var prng = std.Random.DefaultPrng.init(1234); |
| 4427 | const random = prng.random(); | 4427 | const random = prng.random(); |
| 4428 | 4428 | ||
| 4429 | @setEvalBranchQuota(10_000); | 4429 | @setEvalBranchQuota(10_000); |
lib/std/priority_dequeue.zig+7-7| ... | @@ -866,7 +866,7 @@ test "std.PriorityDequeue: shrinkAndFree" { | ... | @@ -866,7 +866,7 @@ test "std.PriorityDequeue: shrinkAndFree" { |
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | test "std.PriorityDequeue: fuzz testing min" { | 868 | test "std.PriorityDequeue: fuzz testing min" { |
| 869 | var prng = std.rand.DefaultPrng.init(0x12345678); | 869 | var prng = std.Random.DefaultPrng.init(0x12345678); |
| 870 | const random = prng.random(); | 870 | const random = prng.random(); |
| 871 | 871 | ||
| 872 | const test_case_count = 100; | 872 | const test_case_count = 100; |
| ... | @@ -878,7 +878,7 @@ test "std.PriorityDequeue: fuzz testing min" { | ... | @@ -878,7 +878,7 @@ test "std.PriorityDequeue: fuzz testing min" { |
| 878 | } | 878 | } |
| 879 | } | 879 | } |
| 880 | 880 | ||
| 881 | fn fuzzTestMin(rng: std.rand.Random, comptime queue_size: usize) !void { | 881 | fn fuzzTestMin(rng: std.Random, comptime queue_size: usize) !void { |
| 882 | const allocator = testing.allocator; | 882 | const allocator = testing.allocator; |
| 883 | const items = try generateRandomSlice(allocator, rng, queue_size); | 883 | const items = try generateRandomSlice(allocator, rng, queue_size); |
| 884 | 884 | ||
| ... | @@ -895,7 +895,7 @@ fn fuzzTestMin(rng: std.rand.Random, comptime queue_size: usize) !void { | ... | @@ -895,7 +895,7 @@ fn fuzzTestMin(rng: std.rand.Random, comptime queue_size: usize) !void { |
| 895 | } | 895 | } |
| 896 | 896 | ||
| 897 | test "std.PriorityDequeue: fuzz testing max" { | 897 | test "std.PriorityDequeue: fuzz testing max" { |
| 898 | var prng = std.rand.DefaultPrng.init(0x87654321); | 898 | var prng = std.Random.DefaultPrng.init(0x87654321); |
| 899 | const random = prng.random(); | 899 | const random = prng.random(); |
| 900 | 900 | ||
| 901 | const test_case_count = 100; | 901 | const test_case_count = 100; |
| ... | @@ -907,7 +907,7 @@ test "std.PriorityDequeue: fuzz testing max" { | ... | @@ -907,7 +907,7 @@ test "std.PriorityDequeue: fuzz testing max" { |
| 907 | } | 907 | } |
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | fn fuzzTestMax(rng: std.rand.Random, queue_size: usize) !void { | 910 | fn fuzzTestMax(rng: std.Random, queue_size: usize) !void { |
| 911 | const allocator = testing.allocator; | 911 | const allocator = testing.allocator; |
| 912 | const items = try generateRandomSlice(allocator, rng, queue_size); | 912 | const items = try generateRandomSlice(allocator, rng, queue_size); |
| 913 | 913 | ||
| ... | @@ -924,7 +924,7 @@ fn fuzzTestMax(rng: std.rand.Random, queue_size: usize) !void { | ... | @@ -924,7 +924,7 @@ fn fuzzTestMax(rng: std.rand.Random, queue_size: usize) !void { |
| 924 | } | 924 | } |
| 925 | 925 | ||
| 926 | test "std.PriorityDequeue: fuzz testing min and max" { | 926 | test "std.PriorityDequeue: fuzz testing min and max" { |
| 927 | var prng = std.rand.DefaultPrng.init(0x87654321); | 927 | var prng = std.Random.DefaultPrng.init(0x87654321); |
| 928 | const random = prng.random(); | 928 | const random = prng.random(); |
| 929 | 929 | ||
| 930 | const test_case_count = 100; | 930 | const test_case_count = 100; |
| ... | @@ -936,7 +936,7 @@ test "std.PriorityDequeue: fuzz testing min and max" { | ... | @@ -936,7 +936,7 @@ test "std.PriorityDequeue: fuzz testing min and max" { |
| 936 | } | 936 | } |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | fn fuzzTestMinMax(rng: std.rand.Random, queue_size: usize) !void { | 939 | fn fuzzTestMinMax(rng: std.Random, queue_size: usize) !void { |
| 940 | const allocator = testing.allocator; | 940 | const allocator = testing.allocator; |
| 941 | const items = try generateRandomSlice(allocator, rng, queue_size); | 941 | const items = try generateRandomSlice(allocator, rng, queue_size); |
| 942 | 942 | ||
| ... | @@ -963,7 +963,7 @@ fn fuzzTestMinMax(rng: std.rand.Random, queue_size: usize) !void { | ... | @@ -963,7 +963,7 @@ fn fuzzTestMinMax(rng: std.rand.Random, queue_size: usize) !void { |
| 963 | } | 963 | } |
| 964 | } | 964 | } |
| 965 | 965 | ||
| 966 | fn generateRandomSlice(allocator: std.mem.Allocator, rng: std.rand.Random, size: usize) ![]u32 { | 966 | fn generateRandomSlice(allocator: std.mem.Allocator, rng: std.Random, size: usize) ![]u32 { |
| 967 | var array = std.ArrayList(u32).init(allocator); | 967 | var array = std.ArrayList(u32).init(allocator); |
| 968 | try array.ensureTotalCapacity(size); | 968 | try array.ensureTotalCapacity(size); |
| 969 | 969 |
lib/std/sort.zig+1-1| ... | @@ -379,7 +379,7 @@ test "sort with context in the middle of a slice" { | ... | @@ -379,7 +379,7 @@ test "sort with context in the middle of a slice" { |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | test "sort fuzz testing" { | 381 | test "sort fuzz testing" { |
| 382 | var prng = std.rand.DefaultPrng.init(0x12345678); | 382 | var prng = std.Random.DefaultPrng.init(0x12345678); |
| 383 | const random = prng.random(); | 383 | const random = prng.random(); |
| 384 | const test_case_count = 10; | 384 | const test_case_count = 10; |
| 385 | 385 |
lib/std/treap.zig+4-4| ... | @@ -18,7 +18,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -18,7 +18,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 18 | 18 | ||
| 19 | /// A customized pseudo random number generator for the treap. | 19 | /// A customized pseudo random number generator for the treap. |
| 20 | /// This just helps reducing the memory size of the treap itself | 20 | /// This just helps reducing the memory size of the treap itself |
| 21 | /// as std.rand.DefaultPrng requires larger state (while producing better entropy for randomness to be fair). | 21 | /// as std.Random.DefaultPrng requires larger state (while producing better entropy for randomness to be fair). |
| 22 | const Prng = struct { | 22 | const Prng = struct { |
| 23 | xorshift: usize = 0, | 23 | xorshift: usize = 0, |
| 24 | 24 | ||
| ... | @@ -305,7 +305,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -305,7 +305,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 305 | // https://lemire.me/blog/2017/09/18/visiting-all-values-in-an-array-exactly-once-in-random-order/ | 305 | // https://lemire.me/blog/2017/09/18/visiting-all-values-in-an-array-exactly-once-in-random-order/ |
| 306 | fn SliceIterRandomOrder(comptime T: type) type { | 306 | fn SliceIterRandomOrder(comptime T: type) type { |
| 307 | return struct { | 307 | return struct { |
| 308 | rng: std.rand.Random, | 308 | rng: std.Random, |
| 309 | slice: []T, | 309 | slice: []T, |
| 310 | index: usize = undefined, | 310 | index: usize = undefined, |
| 311 | offset: usize = undefined, | 311 | offset: usize = undefined, |
| ... | @@ -313,7 +313,7 @@ fn SliceIterRandomOrder(comptime T: type) type { | ... | @@ -313,7 +313,7 @@ fn SliceIterRandomOrder(comptime T: type) type { |
| 313 | 313 | ||
| 314 | const Self = @This(); | 314 | const Self = @This(); |
| 315 | 315 | ||
| 316 | pub fn init(slice: []T, rng: std.rand.Random) Self { | 316 | pub fn init(slice: []T, rng: std.Random) Self { |
| 317 | return Self{ | 317 | return Self{ |
| 318 | .rng = rng, | 318 | .rng = rng, |
| 319 | .slice = slice, | 319 | .slice = slice, |
| ... | @@ -353,7 +353,7 @@ test "std.Treap: insert, find, replace, remove" { | ... | @@ -353,7 +353,7 @@ test "std.Treap: insert, find, replace, remove" { |
| 353 | var treap = TestTreap{}; | 353 | var treap = TestTreap{}; |
| 354 | var nodes: [10]TestNode = undefined; | 354 | var nodes: [10]TestNode = undefined; |
| 355 | 355 | ||
| 356 | var prng = std.rand.DefaultPrng.init(0xdeadbeef); | 356 | var prng = std.Random.DefaultPrng.init(0xdeadbeef); |
| 357 | var iter = SliceIterRandomOrder(TestNode).init(&nodes, prng.random()); | 357 | var iter = SliceIterRandomOrder(TestNode).init(&nodes, prng.random()); |
| 358 | 358 | ||
| 359 | // insert check | 359 | // insert check |
src/reduce.zig+2-2| ... | @@ -136,7 +136,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -136,7 +136,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 136 | var more_fixups: Ast.Fixups = .{}; | 136 | var more_fixups: Ast.Fixups = .{}; |
| 137 | defer more_fixups.deinit(gpa); | 137 | defer more_fixups.deinit(gpa); |
| 138 | 138 | ||
| 139 | var rng = std.rand.DefaultPrng.init(seed); | 139 | var rng = std.Random.DefaultPrng.init(seed); |
| 140 | 140 | ||
| 141 | // 1. Walk the AST of the source file looking for independent | 141 | // 1. Walk the AST of the source file looking for independent |
| 142 | // reductions and collecting them all into an array list. | 142 | // reductions and collecting them all into an array list. |
| ... | @@ -274,7 +274,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -274,7 +274,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 274 | return std.process.cleanExit(); | 274 | return std.process.cleanExit(); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | fn sortTransformations(transformations: []Walk.Transformation, rng: std.rand.Random) void { | 277 | fn sortTransformations(transformations: []Walk.Transformation, rng: std.Random) void { |
| 278 | rng.shuffle(Walk.Transformation, transformations); | 278 | rng.shuffle(Walk.Transformation, transformations); |
| 279 | // Stable sort based on priority to keep randomness as the secondary sort. | 279 | // Stable sort based on priority to keep randomness as the secondary sort. |
| 280 | // TODO: introduce transformation priorities | 280 | // TODO: introduce transformation priorities |
src/resinator/compile.zig+1-1| ... | @@ -3356,7 +3356,7 @@ test "StringTable" { | ... | @@ -3356,7 +3356,7 @@ test "StringTable" { |
| 3356 | } | 3356 | } |
| 3357 | break :ids buf; | 3357 | break :ids buf; |
| 3358 | }; | 3358 | }; |
| 3359 | var prng = std.rand.DefaultPrng.init(0); | 3359 | var prng = std.Random.DefaultPrng.init(0); |
| 3360 | var random = prng.random(); | 3360 | var random = prng.random(); |
| 3361 | random.shuffle(u16, &ids); | 3361 | random.shuffle(u16, &ids); |
| 3362 | 3362 |