rsgen is a tiny library and command line tool that generates random characters string(s).
Add the following to your Cargo.toml:
[dependencies]
rsgen = "0.2"use rsgen::{gen_random_string, OutputCharsType};
let output_chars_type = OutputCharsType::LatinAlphabetAndNumeric {
use_upper_case: true,
use_lower_case: true,
};
let _random_string = gen_random_string(32, output_chars_type);rsgen is written in Rust. Thus you should install the latest Rust ecosystem in advance.
refs. rustup
$ cargo install -f rsgen
$ git clone https://github.com/sadaie/rsgen.git
$ cd rsgen
$ cargo build --release
$ ls target/release/
build deps examples incremental native rsgen rsgen.d
$ rsgen
V05ZHhKa
$ rsgen -c 12
TpzjXxem3U5x
$ rsgen -c 12 -l 10
2S18UasnECKx
xCLlTp4tZmn3
f9jsbGnSWZtB
jFrPnstxHsr8
K9xZAK0R8KHH
85EXezRgeceo
QOtY5BFwEZBl
HBaFlCFN7t9W
blOM7ZsviUBw
XBDSOETSLzUR
-f,--fastoption sets to use the fast but NOT secure RNG, Xorshift.-n,--numericoption sets to restrict the output to be numeric.-p,--printable-asciioption sets to use the printable ASCII withoutSPACE.-P,--printable-ascii-with-spaceoption sets to use the printable ASCII withSPACE.--only-upper-caseoption sets to use upper case letters only.--only-lower-caseoption sets to use lower case letters only.--only-latin-alphabetoption sets to use the Latin alphabet only, not includes numeric characters.
MIT license.