diff --git a/README.md b/README.md index 5e77bd2..01f2f5e 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ that if you update one, you may need to also update the other. ### Version Changes +* 2026-01-09 zig 0.16.0-dev.2075 - move randomness API to `std.Io`, see [#30709](https://codeberg.org/ziglang/zig/pulls/30709) * 2026-01-07 zig 0.16.0-dev.2040 - adjust temp files, see [#30683](https://codeberg.org/ziglang/zig/pulls/30683) * 2026-01-06 zig 0.16.0-dev.1976 - move process API to `std.Io` and changes to main/environ/argv, see [#30644](https://codeberg.org/ziglang/zig/pulls/30644) * *2025-12-28* zig 0.16.0-dev.1859 - file system I/O integrated with the std.Io interface, see [#30232](https://codeberg.org/ziglang/zig/pulls/30232) diff --git a/build.zig b/build.zig index c2958e3..be323c9 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.16.0-dev.2040"; + const required_zig = "0.16.0-dev.2075"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -206,7 +206,7 @@ pub fn build(b: *Build) !void { var prng = std.Random.DefaultPrng.init(blk: { var seed: u64 = undefined; - try std.posix.getrandom(std.mem.asBytes(&seed)); + io.random(std.mem.asBytes(&seed)); break :blk seed; }); const rnd = prng.random(); @@ -1287,7 +1287,7 @@ const exercises = [_]Exercise{ \\Max difference (new fn): 0.014 , }, - .{ .main_file = "110_quiz9.zig", .output = + .{ .main_file = "110_quiz9.zig", .output = \\Toggle pins with XOR on PORTB \\----------------------------- \\ 1100 // (initial state of PORTB) diff --git a/test/tests.zig b/test/tests.zig index 94cf6aa..509cb54 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -394,7 +394,11 @@ fn heal(allocator: Allocator, exercises: []const Exercise, work_path: []const u8 fn createTempPath(b: *Build) ![]const u8 { const io = b.graph.io; - const rand_int = std.crypto.random.int(u64); + const rand_int = r: { + var x: u64 = undefined; + io.random(@ptrCast(&x)); + break :r x; + }; const tmp_dir_sub_path = "tmp" ++ std.Io.Dir.path.sep_str ++ std.fmt.hex(rand_int); const result_path = b.cache_root.join(b.allocator, &.{tmp_dir_sub_path}) catch @panic("OOM"); try b.cache_root.handle.createDirPath(io, tmp_dir_sub_path);