From 12cfe0231925848b221b0a56ae8bae9a5e4f7dae Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Wed, 10 Jun 2020 01:10:38 -0500 Subject: [PATCH] reworked coinflip command --- commands.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 6be1af3..7630de4 100644 --- a/commands.go +++ b/commands.go @@ -5,6 +5,7 @@ This contains all of our commands used throughout the bot except for image gathe package main import ( + "math" "math/rand" "strconv" ) @@ -12,10 +13,10 @@ import ( // flip a coin func coinflip(author string) string{ // get a random 1 or 0 - num := rand.Intn(1) + num := math.Mod(float64(rand.Intn(100)), 2) // modulo of random number between 0 and 100 // return string based on number - if num == 0 { // heads + if int(num) == 0 { // heads return "<@" + author + "> flipped a coin, it landed on **heads!**" } else { // tails return "<@" + author + "> flipped a coin, it landed on **tails!**"