1 files changed, 14 insertions, 0 deletions
diff --git a/src/extensions/Random.ts b/src/extensions/Random.ts
index 212e1c9a..fe865891 100644
--- a/src/extensions/Random.ts
+++ b/src/extensions/Random.ts
@@ -89,4 +89,18 @@ export class Random {
}
return array;
}
+
+ public static getString(choices: string, length: number) {
+ const _choices = choices.split("");
+ const result = new Array(length);
+ for (const i in result) {
+ result[i] = _choices[Random.nextInt(0, _choices.length)];
+ }
+
+ return result.join("");
+ }
+
+ public static getHexString(length: number) {
+ return this.getString("0123456789ABCDEF", length);
+ }
}
|