mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-24 14:46:27 -08:00
swap to crypto.randomInt over Math.random
This commit is contained in:
parent
261b81ee04
commit
8f6a5b5474
|
@ -2,6 +2,7 @@ import axios from "axios";
|
|||
import Discord, { Client, TextBasedChannel } from "discord.js";
|
||||
import { readFile, writeFile } from "fs";
|
||||
import { Readable } from "node:stream";
|
||||
import crypto from "node:crypto";
|
||||
import { files } from "./accounts";
|
||||
|
||||
import * as Accounts from "./accounts";
|
||||
|
@ -16,7 +17,7 @@ export type FileVisibility = "public" | "anonymous" | "private"
|
|||
export function generateFileId(length:number=5) {
|
||||
let fid = ""
|
||||
for (let i = 0; i < length; i++) {
|
||||
fid += alphanum[Math.floor(Math.random()*alphanum.length)]
|
||||
fid += alphanum[crypto.randomInt(0,alphanum.length)]
|
||||
}
|
||||
return fid
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue