From be86d6a7a9474b2b674b1105673f2e876abf359e Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 9 May 2024 12:43:23 +0200 Subject: [PATCH] add util/random/rollDiceMultiDifferentValue and randomEnumMultiDifferentValue --- src/util/random/randomEnumMultiDifferentValue.ts | 9 +++++++++ src/util/random/rollDiceMultiDifferentValue.ts | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/util/random/randomEnumMultiDifferentValue.ts create mode 100644 src/util/random/rollDiceMultiDifferentValue.ts diff --git a/src/util/random/randomEnumMultiDifferentValue.ts b/src/util/random/randomEnumMultiDifferentValue.ts new file mode 100644 index 0000000..cd5f1f1 --- /dev/null +++ b/src/util/random/randomEnumMultiDifferentValue.ts @@ -0,0 +1,9 @@ +/** + * Gets multiple random enum values from all available enums. + * @param anEnum Enum type + * @param count Number of random values to return + * @returns Random enum values + */ +export default function randomEnumMultiDifferentValue>(anEnum: T, count: number): T[keyof T][] { + return [] +} diff --git a/src/util/random/rollDiceMultiDifferentValue.ts b/src/util/random/rollDiceMultiDifferentValue.ts new file mode 100644 index 0000000..f82265d --- /dev/null +++ b/src/util/random/rollDiceMultiDifferentValue.ts @@ -0,0 +1,15 @@ +import rollDiceDifferentValue from "./rollDiceDifferentValue" + +/** + * Rolls a dice and returns multiple different values. + * @param maxValue Max. dice value + * @param count Number of random values to return + * @returns Dice values + */ +export default function rollDiceMultiDifferentValue(maxValue: number, count: number) : number[] { + const result : number[] = [] + for (let i = 0; i < count; i++) { + result.push(rollDiceDifferentValue(maxValue, ...result)) + } + return result +}