-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsplashes.rs
46 lines (38 loc) · 1.34 KB
/
splashes.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// LICENSE: https://en.wikipedia.org/wiki/Creative_Commons_license
use colored::Colorize;
pub static SPLASHES: &[&str] = &[
"There are reasons to use rust. - PwnWriter",
"whatsoever a man soweth, that shall he also reap. - Dylanaraps",
"Bounty plss, this time - Knight_yagami",
"Hacking in a nutshell",
"In the world of programming, curiosity is the compass. - Ashokcpg",
"Compile once, Hack forever - PwnWriter",
"I want my system to hack!! wOoO",
"Hello everyone, this is your daily dose for Bounty - PwnWriter",
"Why no work?, Bro RTFM :/",
];
// Not using rand crate anymore
// https://users.rust-lang.org/t/cheap-random-number-generator-with-std/90589/6
fn generate_random_number() -> usize {
let current_time = std::time::SystemTime::now()
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("Time went backwards")
.as_micros();
(current_time % SPLASHES.len() as u128) as usize
}
pub fn show_splashes() -> String {
let rng = generate_random_number();
let kanha_version = env!("CARGO_PKG_VERSION");
let logo = format!(
r#"
┓┏┓ ┓
┃┫ ┏┓┏┓┣┓┏┓
┛┗┛┗┻┛┗┛┗┗┻ v{}
"#,
kanha_version,
)
.bold()
.purple();
let splash = SPLASHES[rng].italic();
format!("{logo} {splash}")
}