diff options
| author | itsnoctural <itsnoctural@noreply.codeberg.org> | 2026-01-09 00:19:24 +0200 |
|---|---|---|
| committer | itsnoctural <itsnoctural@noreply.codeberg.org> | 2026-01-09 00:19:24 +0200 |
| commit | 551008ac19d262dd30ddaa0c8f39776b419682d8 (patch) | |
| tree | e1dd36825ce57798c85bd11e2878783a88462916 | |
| parent | 335aaafcff2bfa1337cb73b39e6ffd40d691be04 (diff) | |
fix: use new randomness api
| -rw-r--r-- | build.zig | 4 | ||||
| -rw-r--r-- | test/tests.zig | 6 |
2 files changed, 7 insertions, 3 deletions
@@ -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); |
