Skip to content

Instantly share code, notes, and snippets.

@barseghyanartur
Created February 6, 2023 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barseghyanartur/9566e4bc990cdac737c8532a4058e97b to your computer and use it in GitHub Desktop.
Save barseghyanartur/9566e4bc990cdac737c8532a4058e97b to your computer and use it in GitHub Desktop.
Rust random boolean

Random boolean in Rust

Prerequisites

[dependencies]
rand = "0.8.5"

Usage example

use rand::Rng;
let mut rng = rand::thread_rng();
let choice: bool = rng.gen();  // This is the random value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment