pub fn from_rng<R: Rng>(rng: &mut R) -> Language {
        // none of the unwraps in this method should ever fail
        let phonemes = Phonemes::from_rand(rng);
        let c_map = CONSONANT_MAPPINGS.choose(rng).unwrap();
        let v_map = VOWEL_MAPPINGS.choose(rng).unwrap();
        let orthography = Orthography::new().with_mapping(c_map).with_mapping(v_map);
        let syllable: Vec<char> = SYLLABLESTRUCT.choose(rng).unwrap().chars().collect();
        let min_syllable = if syllable.len() < 3 {
            rng.gen_range(1u8, 3u8) + 1
        } else {
            rng.gen_range(1u8, 3u8)
        };
        let max_syllable = rng.gen_range(min_syllable + 1, 7u8);
        let base = BaseLanguage{phonemes, orthography, syllable, min_syllable, max_syllable};
        // TODO: generate genitive and definite
        let genitive = base.orthography.transform(&base.make_syllable(rng));
        let definite = base.orthography.transform(&base.make_syllable(rng));
        let place = (0u8..rng.gen_range(5, 10)).map(|_| base.make_syllable(rng)).collect();
        let region = (0u8..rng.gen_range(5, 10)).map(|_| base.make_syllable(rng)).collect();
        let person = (0u8..rng.gen_range(7, 14)).map(|_| base.make_syllable(rng)).collect();
        fn make_title<R: Rng>(rng: &mut R, base: &BaseLanguage) -> String {
            let title = base.orthography.transform(&base.make_syllable(rng));
            if rng.gen::<f32>() < 0.9 {
                capitalize(&title)
            } else {
                title
            }
        }
        let mut titles = Vec::new();
        let title_count: usize = rng.gen_range(4u8, 8u8) as usize;
        while titles.len() < title_count {
            let title = make_title(rng, &base);
            if !titles.contains(&title) {
                titles.push(title);
            }
        };
        let surname_last = rng.gen::<bool>();
        Language{base, genitive, definite, place, region, person, titles, surname_last}
    }
/// Creates a random language from the provide random number generator.
Creates a random language from the provide random number generator.
Creates a random language from the provide random number generator .
pub fn from_rng<R: Rng>(rng: &mut R) -> Language {
        // none of the unwraps in this method should ever fail
        let phonemes = Phonemes::from_rand(rng);
        let c_map = CONSONANT_MAPPINGS.choose(rng).unwrap();
        let v_map = VOWEL_MAPPINGS.choose(rng).unwrap();
        let orthography = Orthography::new().with_mapping(c_map).with_mapping(v_map);
        let syllable: Vec<char> = SYLLABLESTRUCT.choose(rng).unwrap().chars().collect();
        let min_syllable = if syllable.len() < 3 {
            rng.gen_range(1u8, 3u8) + 1
        } else {
            rng.gen_range(1u8, 3u8)
        };
        let max_syllable = rng.gen_range(min_syllable + 1, 7u8);
        let base = BaseLanguage{phonemes, orthography, syllable, min_syllable, max_syllable};
        // TODO: generate genitive and definite
        let genitive = base.orthography.transform(&base.make_syllable(rng));
        let definite = base.orthography.transform(&base.make_syllable(rng));
        let place = (0u8..rng.gen_range(5, 10)).map(|_| base.make_syllable(rng)).collect();
        let region = (0u8..rng.gen_range(5, 10)).map(|_| base.make_syllable(rng)).collect();
        let person = (0u8..rng.gen_range(7, 14)).map(|_| base.make_syllable(rng)).collect();
        fn make_title<R: Rng>(rng: &mut R, base: &BaseLanguage) -> String {
            let title = base.orthography.transform(&base.make_syllable(rng));
            if rng.gen::<f32>() < 0.9 {
                capitalize(&title)
            } else {
                title
            }
        }
        let mut titles = Vec::new();
        let title_count: usize = rng.gen_range(4u8, 8u8) as usize;
        while titles.len() < title_count {
            let title = make_title(rng, &base);
            if !titles.contains(&title) {
                titles.push(title);
            }
        };
        let surname_last = rng.gen::<bool>();
        Language{base, genitive, definite, place, region, person, titles, surname_last}
    }
pub fn from_rng < R : Rng > ( rng : & mut R ) -> Language { // none of the unwraps in this method should ever fail let phonemes = Phonemes :: from_rand ( rng ) ; let c_map = CONSONANT_MAPPINGS . choose ( rng ) . unwrap ( ) ; let v_map = VOWEL_MAPPINGS . choose ( rng ) . unwrap ( ) ; let orthography = Orthography :: new ( ) . with_mapping ( c_map ) . with_mapping ( v_map ) ; let syllable : Vec < char > = SYLLABLESTRUCT . choose ( rng ) . unwrap ( ) . chars ( ) . collect ( ) ; let min_syllable = if syllable . len ( ) < 3 { rng . gen_range ( 1u8 , 3u8 ) + 1 } else { rng . gen_range ( 1u8 , 3u8 ) } ; let max_syllable = rng . gen_range ( min_syllable + 1 , 7u8 ) ; let base = BaseLanguage { phonemes , orthography , syllable , min_syllable , max_syllable } ; // TODO: generate genitive and definite let genitive = base . orthography . transform ( & base . make_syllable ( rng ) ) ; let definite = base . orthography . transform ( & base . make_syllable ( rng ) ) ; let place = ( 0u8 .. rng . gen_range ( 5 , 10 ) ) . map ( | _ | base . make_syllable ( rng ) ) . collect ( ) ; let region = ( 0u8 .. rng . gen_range ( 5 , 10 ) ) . map ( | _ | base . make_syllable ( rng ) ) . collect ( ) ; let person = ( 0u8 .. rng . gen_range ( 7 , 14 ) ) . map ( | _ | base . make_syllable ( rng ) ) . collect ( ) ; fn make_title < R : Rng > ( rng : & mut R , base : & BaseLanguage ) -> String { let title = base . orthography . transform ( & base . make_syllable ( rng ) ) ; if rng . gen :: < f32 > ( ) < 0.9 { capitalize ( & title ) } else { title } } let mut titles = Vec :: new ( ) ; let title_count : usize = rng . gen_range ( 4u8 , 8u8 ) as usize ; while titles . len ( ) < title_count { let title = make_title ( rng , & base ) ; if ! titles . contains ( & title ) { titles . push ( title ) ; } } ; let surname_last = rng . gen :: < bool > ( ) ; Language { base , genitive , definite , place , region , person , titles , surname_last } }
Creates a random language from the provide random number generator.
Creates a random language from the provide random number generator .
rng
&mut R