mercredi 27 mai 2015

generate random letter and fixed number combination

I need to generate a random sequence of a single letter and 6 digit combination, example: F841257

I was looking into rand crate, but something doesn't quite work.

extern crate rand;

fn main() {
    println!("{:?}", rand::random::<char>());
}

prints something like '\u{6ae02}' and println!("{}", rand::random::<char>()); produces some weird glyph.

Can someone point me in the right direction of how I could achieve this?




Aucun commentaire:

Enregistrer un commentaire