Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Loops-Break/Jakt/loops-break.jakt
Normal file
22
Task/Loops-Break/Jakt/loops-break.jakt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
fn random(mut random_source: File = File::open_for_reading("/dev/urandom")) throws -> u64 {
|
||||
mut buffer = [0u8; 4]
|
||||
random_source.read(buffer)
|
||||
mut result = 0u64
|
||||
for byte in buffer {
|
||||
result <<= 8
|
||||
result += byte as! u64
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fn main() {
|
||||
while true {
|
||||
let n = random() % 20
|
||||
println("{}", n)
|
||||
if n == 10 {
|
||||
break
|
||||
}
|
||||
|
||||
println("{}", random() % 20)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue