Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "Which expression maps Math.random() to an integer in the closed interval [minimum, maximum] when both bounds are valid integers?" on CodeWiki (https://codewiki.com/practice/mcq/javascript/math-object/inclusive-random-integer-formula/).
Context (verbatim from the page):
"""
Which expression maps Math.random() to an integer in the closed interval [minimum, maximum] when both bounds are valid integers?
minimum + Math.floor(Math.random() * (maximum - minimum + 1))
minimum + Math.round(Math.random() * (maximum - minimum))
Math.floor(Math.random() * maximum) + minimum
minimum + Math.ceil(Math.random() * (maximum - minimum + 1))
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in JavaScript. Where you are unsure, say so.