/// Chooses a random account from a specific user.
Chooses a random account from a specific user.
Chooses a random account from a specific user .
fn random_account_from(&self, rng: &mut StdRng, owner: &User) -> Option<Account> {
        let accounts = self
            .accounts
            .values()
            .filter(|a| &a.owner == owner)
            .collect::<Vec<&Account>>();
        let len = accounts.len();
        if len > 0 {
            return Some((*accounts.get(rng.gen_range(0, len)).unwrap()).clone());
        }
        None
    }
fn random_account_from ( & self , rng : & mut StdRng , owner : & User ) -> Option < Account > { let accounts = self . accounts . values ( ) . filter ( | a | & a . owner == owner ) . collect :: < Vec < & Account > > ( ) ; let len = accounts . len ( ) ; if len > 0 { return Some ( ( * accounts . get ( rng . gen_range ( 0 , len ) ) . unwrap ( ) ) . clone ( ) ) ; } None }
Chooses a random account from a specific user.
Chooses a random account from a specific user .
&self
rng
&mut StdRng
owner
&User