EasyJavaScriptTypeScript

Insecure Randomness — Use a Cryptographic Source

JavaScriptSecurityCryptographic Issues

A password-reset token generator is meant to build a token from a caller-supplied source of cryptographically-random integers.

The bug: the buggy version ignores the secure source entirely and calls Math.random() instead — Math.random is a fast, statistically-predictable PRNG never intended for security purposes; tokens generated from it can be predicted or brute-forced far more easily than a real attacker should need.

Your task: fix solve(randomInts) so it builds the token from the provided `randomInts` array (mapping each integer to a character via % alphabet.length), never by generating its own randomness internally.

Sample tests

Test #1First three alphabet characters
Input: [[0,1,2]]
Output: "ABC"
Test #2Empty input produces empty token
Input: [[]]
Output: ""
Test #3Indices wrap around via modulo (alphabet has 62 characters)
Input: [[61,62,63]]
Output: "9AB"