mnml/server/src/names.rs
2019-07-29 12:20:56 +10:00

115 lines
1.8 KiB
Rust

use rand::prelude::*;
use rand::{thread_rng};
const FIRSTS: [&'static str; 44] = [
"artificial",
"ambient",
"borean",
"brewing",
"bristling",
"compressed",
"ceramic",
"chromatic",
"concave",
"convex",
"distorted",
"deserted",
"emotive",
"emotionless",
"fierce",
"fossilised",
"inverted",
"leafy",
"lurking",
"limitless",
"metallic",
"mossy",
"mighty",
"modulated",
"nocturnal",
"noisy",
"nutritious",
"powerful",
"obscure",
"organic",
"oxygenated",
"oscillating",
"ossified",
"piscine",
"purified",
"recalcitrant",
"rogue",
"subversive",
"subterranean",
"subsonic",
"synthetic",
"sweet",
"terrestrial",
"weary",
];
const LASTS: [&'static str; 48] = [
"artifact",
"assembly",
"carbon",
"console",
"construct",
"craft",
"design",
"drone",
"distortion",
"detector",
"energy",
"entropy",
"foilage",
"forest",
"form",
"fossil",
"frequency",
"function",
"information",
"insulator",
"layout",
"lifeform",
"landmass",
"lens",
"mechanism",
"mountain",
"nectar",
"oak",
"oxide",
"pattern",
"plant",
"poseidon",
"problem",
"receiver",
"replicant",
"river",
"scaffold",
"structure",
"shape",
"signal",
"synthesiser",
"system",
"tower",
"transmitter",
"traveller",
"vibration",
"warning",
"wildlife",
];
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
}