mercredi 1 janvier 2020

Generate a string of random ascii printable characters with n size in rust

I'm trying to make a function using Rust that, given an integer, returns a value of type String.

The main problem I'm facing is creating a random character cause then i can simply concatenate lots of this characters in a loop or something like that and then return the final string. I've tried to find way to type cast an integer returned from the random function in the Rand crate (as you can do in C++) but this does not seem to be the way to go.

What should I do?




Aucun commentaire:

Enregistrer un commentaire