Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn throw_dice(n: u32, faces: u64, total: u64) -> u64 {
- ((faces.pow(n) - 1) % total) * (n as u64)
- }
- fn main() {
- println!("{}", throw_dice(3, 6, 7));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement