jeudi 20 mai 2021

How do I use the rand crate without the standard library?

I'm doing embedded game development for the Sega Megadrive with Rust and would like a random number generator to increase replayability. It can be pseudo-random: there's no security stuff required.

I've been looking at the rand crate which falls in the "No standard library" department, but I'm not sure on how to use it with this in my Crate.toml:

[dependencies]
rand = {version = "0.8.3", default-features = false}

When I disable default-features, there's no random function in the prelude anymore. There is the Rng trait but I'm too inexperienced to figure out how to use it.




Aucun commentaire:

Enregistrer un commentaire