You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
294 B
10 lines
294 B
extern crate rand;
|
|
use rand::thread_rng;
|
|
use crate::all_sayings::all_sayings;
|
|
use crate::choose_saying::rand::prelude::IteratorRandom;
|
|
|
|
pub fn random_saying() -> String {
|
|
let mut rng = thread_rng();
|
|
all_sayings().iter().choose(&mut rng).expect("Error getting random saying.").to_string()
|
|
}
|