aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/util.rs
blob: 44fcf1c60cf6e6719e009d94e2961eb1d745cc7f (plain)
1
2
3
4
5
6
7
8
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()
}