mnml/server/src/names.rs
2019-04-26 13:08:08 +10:00

55 lines
900 B
Rust

use rand::prelude::*;
use rand::{thread_rng};
const FIRSTS: [&'static str; 17] = [
"fierce",
"obscure",
"mighty",
"rogue",
"inverted",
"recalcitrant",
"subterranean",
"brewing",
"nocturnal",
"convex",
"concave",
"piscine",
"dub",
"borean",
"lurking",
"leafy",
"nutritious",
];
const LASTS: [&'static str; 16] = [
"kaffe",
"river",
"oak",
"replicant",
"mechanism",
"function",
"shape",
"form",
"poseidon",
"mountain",
"river",
"forest",
"problem",
"warning",
"information",
"witness",
];
pub fn name() -> String {
let mut rng = thread_rng();
let first = rng.gen_range(0, FIRSTS.len() - 1);
let last = rng.gen_range(0, LASTS.len() - 1);
let mut s = String::new();
s.push_str(FIRSTS[first]);
s.push(' ');
s.push_str(LASTS[last]);
s
}