mnml/server/src/names.rs
2019-07-17 17:26:01 +10:00

81 lines
1.3 KiB
Rust

use rand::prelude::*;
use rand::{thread_rng};
const FIRSTS: [&'static str; 25] = [
"borean",
"brewing",
"bristling",
"compressed",
"concave",
"convex",
"distorted",
"dub",
"fierce",
"inverted",
"leafy",
"lurking",
"metallic",
"mighty",
"nocturnal",
"nutritious",
"obscure",
"organic",
"piscine",
"purified",
"recalcitrant",
"rogue",
"subterranean",
"sweet",
"weary",
];
const LASTS: [&'static str; 34] = [
"artifact",
"assembly",
"console",
"construct",
"design",
"entropy",
"foilage",
"forest",
"form",
"frequency",
"function",
"information",
"insulator",
"kaffe",
"layout",
"lens",
"mechanism",
"mountain",
"nectar",
"oak",
"plant",
"poseidon",
"problem",
"replicant",
"river",
"river",
"shape",
"signal",
"tower",
"transmitter",
"traveller",
"warning",
"wildlife",
"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
}