Project: Random Bytes
Write a program to generate a random stream of bytes. The program should accept three values on the command line: minimum byte value, maximum byte value and the number of bytes to generate. Include assertions to check that the command line min and max are in the range 0-255.
Output
$ rustc RandomBytes.rs
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:10:5
|
10 | if args.len() != 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> RandomBytes.rs:12:3
|
12 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:14:22
|
14 | let mut min:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:14:44
|
14 | let mut min:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:15:22
|
15 | let mut max:isize = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:15:44
|
15 | let mut max:isize = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:16:24
|
16 | let mut count:isize = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:16:46
|
16 | let mut count:isize = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `irandom` in this scope
--> RandomBytes.rs:26:15
|
26 | b = (min + irandom(diff)) as u8;
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `putbyte` in this scope
--> RandomBytes.rs:27:4
|
27 | putbyte(b);
| ^^^^^^^ not found in this scope
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc RandomBytes.rs
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:10:5
|
10 | if args.len() != 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> RandomBytes.rs:12:3
|
12 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:14:22
|
14 | let mut min:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:14:44
|
14 | let mut min:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:15:22
|
15 | let mut max:isize = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:15:44
|
15 | let mut max:isize = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> RandomBytes.rs:16:24
|
16 | let mut count:isize = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> RandomBytes.rs:16:46
|
16 | let mut count:isize = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `irandom` in this scope
--> RandomBytes.rs:26:15
|
26 | b = (min + irandom(diff)) as u8;
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `putbyte` in this scope
--> RandomBytes.rs:27:4
|
27 | putbyte(b);
| ^^^^^^^ not found in this scope
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0425`.