From 5ecf3496201bc400287613a52e95a3a5bf5f7b77 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Thu, 24 Sep 2020 16:17:09 -0400 Subject: [PATCH] modified random dice method to be a generic method --- .../com/wyattjmiller/dicerollerapp/Randomizer.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/wyattjmiller/dicerollerapp/Randomizer.kt b/app/src/main/java/com/wyattjmiller/dicerollerapp/Randomizer.kt index 57468fe..cc8b23d 100644 --- a/app/src/main/java/com/wyattjmiller/dicerollerapp/Randomizer.kt +++ b/app/src/main/java/com/wyattjmiller/dicerollerapp/Randomizer.kt @@ -3,16 +3,11 @@ package com.wyattjmiller.dicerollerapp import kotlin.random.Random class Randomizer { - private var mCoin: Array = Coin.values() - private var mDie: Array = Die.values() - - fun randomCoinFlip(): Int { - val rand = Random.nextInt(mCoin.size) - return rand + fun randomCoinFlip(item: Array): Int { + return Random.nextInt(item.size) } - fun randomDieRoll(): Int { - val rand = Random.nextInt(mDie.size) - return rand + fun randomDieRoll(item: Array): Int { + return Random.nextInt(item.size) } } \ No newline at end of file