aboutsummaryrefslogtreecommitdiff
path: root/src/utils/random.ts
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2023-05-07 23:31:10 +0200
committerGravatar Corentin THOMASSET <corentin.thomasset74@gmail.com> 2023-05-14 22:30:23 +0200
commitaad8d84e13ce31c1b7c1cbb930fb8bd4c0abe13a (patch)
treec483e3a25c858c09c73496616d95f168d8b9298d /src/utils/random.ts
parent401f13f7e305d60097db2334642e423c41d8897d (diff)
downloadit-tools-aad8d84e13ce31c1b7c1cbb930fb8bd4c0abe13a.tar.gz
it-tools-aad8d84e13ce31c1b7c1cbb930fb8bd4c0abe13a.tar.zst
it-tools-aad8d84e13ce31c1b7c1cbb930fb8bd4c0abe13a.zip
ui-lib(new-component): added text input component in the c-lib
Diffstat (limited to 'src/utils/random.ts')
-rw-r--r--src/utils/random.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/random.ts b/src/utils/random.ts
index 6df941d..3a13be5 100644
--- a/src/utils/random.ts
+++ b/src/utils/random.ts
@@ -18,4 +18,14 @@ const shuffleArray = <T>(array: T[]): T[] => shuffleArrayMutate([...array]);
const shuffleString = (str: string, delimiter = ''): string => shuffleArrayMutate(str.split(delimiter)).join(delimiter);
-export { randFromArray, randIntFromInterval, random, shuffleArray, shuffleArrayMutate, shuffleString };
+const generateRandomId = () => `id-${random().toString(36).substring(2, 12)}`;
+
+export {
+ randFromArray,
+ randIntFromInterval,
+ random,
+ shuffleArray,
+ shuffleArrayMutate,
+ shuffleString,
+ generateRandomId,
+};