Created
January 13, 2014 03:02
-
-
Save nightpool/8394056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn random_num<T: num::NumCast + num::Num>(n: T) -> T { | |
let rand::Closed01(val) = random::<rand::Closed01<f32>>(); | |
num::cast(val * num::cast(n).unwrap()).unwrap() | |
} |
Author
nightpool
commented
Jan 13, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment