1 stable release

Uses new Rust 2024

1.0.0 Mar 28, 2025

#2055 in Procedural macros

Download history 125/week @ 2025-03-26

125 downloads per month

MIT license

5KB

compile-rand

This crate provides the compile_rand! macro, which will generate a random number of the given integer type at compile time.

In other words, if – for whatever reason – you actually need this XKCD comic:

https://xkcd.com/221/

...then this crate will give it to you!

Usage

use compile_rand::compile_rand;

let r = compile_rand!(i64);
println!("{}", r); // A new number each time the program is compiled.

compile-rand

This crate provides the compile_rand! macro, which will generate a random number of the given integer type at compile time.

In other words, if – for whatever reason – you actually need this:

https://xkcd.com/221/

...then this crate will give it to you!

Dependencies

~1.5MB
~18K SLoC