Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Loops-Break/Zig/loops-break.zig
Normal file
17
Task/Loops-Break/Zig/loops-break.zig
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
const RndGen = std.rand.DefaultPrng;
|
||||
var rnd = RndGen.init(42);
|
||||
// possible improvement: make rng fair
|
||||
var rand_num1: u5 = undefined;
|
||||
var rand_num2: u5 = undefined;
|
||||
while (true) {
|
||||
rand_num1 = rnd.random().int(u5) % 20;
|
||||
try std.io.getStdOut().writer().print("{d}\n", .{rand_num1});
|
||||
if (rand_num1 == 10)
|
||||
break;
|
||||
rand_num2 = rnd.random().int(u5) % 20;
|
||||
try std.io.getStdOut().writer().print("{d}\n", .{rand_num2});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue