Pure Programmer
Blue Matrix


Cluster Map

Project: Random Characters

Write a program to generate a random stream of Unicode characters. The program should accept three values on the command line: minimum character codepoint, maximum character codepoint and the number of characters to generate. Be sure not to output control characters in the specified range. Include assertions to check that the command line min and max are in the range 0-0x1ffff.

Output
$ rustc RandomChars.rs error[E0425]: cannot find value `args` in this scope --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.rs:26:13 | 26 | c = min + irandom(diff); | ^^^^^^^ not found in this scope error[E0425]: cannot find function `isctrl` in this scope --> RandomChars.rs:27:8 | 27 | if !(isctrl(c)) { | ^^^^^^ not found in this scope error[E0425]: cannot find function `putcodepoint` in this scope --> RandomChars.rs:28:4 | 28 | putcodepoint(c); | ^^^^^^^^^^^^ not found in this scope error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0425`. $ rustc RandomChars.rs error[E0425]: cannot find value `args` in this scope --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.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 --> RandomChars.rs:26:13 | 26 | c = min + irandom(diff); | ^^^^^^^ not found in this scope error[E0425]: cannot find function `isctrl` in this scope --> RandomChars.rs:27:8 | 27 | if !(isctrl(c)) { | ^^^^^^ not found in this scope error[E0425]: cannot find function `putcodepoint` in this scope --> RandomChars.rs:28:4 | 28 | putcodepoint(c); | ^^^^^^^^^^^^ not found in this scope error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0425`.

Solution