mnml/server/src/names.rs
2019-05-09 00:23:05 +10:00

73 lines
1.2 KiB
Rust

use rand::prelude::*;
use rand::{thread_rng};
const FIRSTS: [&'static str; 22] = [
"fierce",
"obscure",
"mighty",
"rogue",
"inverted",
"recalcitrant",
"subterranean",
"brewing",
"nocturnal",
"convex",
"concave",
"piscine",
"dub",
"borean",
"lurking",
"leafy",
"nutritious",
"bristling",
"metallic",
"purified",
"organic",
"distorted",
];
const LASTS: [&'static str; 29] = [
"kaffe",
"foilage",
"wildlife",
"design",
"assembly",
"layout",
"transmitter",
"lens",
"artifact",
"frequency",
"entropy",
"console",
"insulator",
"river",
"oak",
"replicant",
"mechanism",
"construct",
"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
}