We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d44c3d9 commit 5c14ac9Copy full SHA for 5c14ac9
1 file changed
source/utils.ts
@@ -2,13 +2,11 @@ import { ENCODING, ENCODING_LEN } from "./constants.js";
2
import { PRNG } from "./types.js";
3
4
export function randomChar(prng: PRNG): string {
5
-
6
// Currently PRNGs generate fractions from 0 to _less than_ 1, so no "%" is necessary.
7
// However, just in case a future PRNG can generate 1,
8
// we are applying "% ENCODING LEN" to wrap back to the first character
9
10
const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
11
- return ENCODING.charAt(randPosition);
+ return ENCODING.charAt(randomPosition);
12
}
13
14
export function replaceCharAt(str: string, index: number, char: string): string {
0 commit comments