diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-27 20:35:22 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-27 20:35:22 +0100 |
commit | 22a8f3d619e8ef89eeb9a60ab0a27aed01aa93f7 (patch) | |
tree | 1d6307c96ebd3456e74509203e1155a2c82ffee1 /planetwars-server/src/util.rs | |
parent | 6ef6a872fe3bbe389e92145b39fd88d864f6a790 (diff) | |
download | planetwars.dev-22a8f3d619e8ef89eeb9a60ab0a27aed01aa93f7.tar.xz planetwars.dev-22a8f3d619e8ef89eeb9a60ab0a27aed01aa93f7.zip |
save all uploaded code bundles in database
Diffstat (limited to 'planetwars-server/src/util.rs')
-rw-r--r-- | planetwars-server/src/util.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/planetwars-server/src/util.rs b/planetwars-server/src/util.rs new file mode 100644 index 0000000..44fcf1c --- /dev/null +++ b/planetwars-server/src/util.rs @@ -0,0 +1,9 @@ +use rand::{distributions::Alphanumeric, Rng}; + +pub fn gen_alphanumeric(length: usize) -> String { + rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(length) + .map(char::from) + .collect() +} |