Node.js · Middle · Question 44 of 75
How do you generate a cryptographically secure random token?
- 1
Date.now().toString(16) - ✓Correct answer:
crypto.randomBytes(32).toString("hex")orcrypto.randomUUID() - 3
Math.random().toString(36)
Explanation
Math.random() is predictable and must not be used for tokens, session IDs or password reset links.