# Need explanation for a JavaScript challenge

I was able to complete it. But I didn’t understand anything
Could someone tell me how it works
“Take a moment to read it and try to understand what this code is doing”
I tried.

The part I am not understanding :-

return Math.floor(Math.random()*(myMax-myMin + 1)) + myMin;

Your code so far

``````
function randomRange(myMin, myMax) {
// Only change code below this line
return Math.floor(Math.random()*(myMax-myMin + 1)) + myMin;

// Only change code above this line
}

``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36`.

Challenge: Generate Random Whole Numbers within a Range

Link to the challenge:

something specific here you do not understand?

try to sub in two possible values for myMax and myMin and resolve the values

I want to understand the way it works.

Not what is happening behind the scenes. I want to understand the code

you can do it! take pen and paper and try to see what’s going inside the parenthesis
for example, if `myMin` is 4 and `myMax` is 7…

`Math.floor(Math.random()*(7- 4 + 1)) + 4;`

what happens next?

2 Likes
{"ft_lang_label":"__label__en","ft_lang_prob":0.62861454,"math_prob":0.73204505,"size":696,"snap":"2022-40-2023-06","text_gpt3_token_len":188,"char_repetition_ratio":0.098265894,"word_repetition_ratio":0.03883495,"special_character_ratio":0.2902299,"punctuation_ratio":0.17123288,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96637094,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-26T09:46:52Z\",\"WARC-Record-ID\":\"<urn:uuid:1fb11ca4-ff7f-4fd8-84f4-955ba0f48a8c>\",\"Content-Length\":\"32964\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:27ca2d1d-4063-433b-8fa2-a1f8401d1ca1>\",\"WARC-Concurrent-To\":\"<urn:uuid:08610c3f-2c04-440d-9955-40806d896e73>\",\"WARC-IP-Address\":\"64.71.144.205\",\"WARC-Target-URI\":\"https://forum.freecodecamp.org/t/need-explanation-for-a-javascript-challenge/423520\",\"WARC-Payload-Digest\":\"sha1:KWPV4BSUXA566AFZIEHIPQNEGQV3SJGM\",\"WARC-Block-Digest\":\"sha1:S4H6Q7GLGVGG7HJ2HE7RJBU6RE6E3OVJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030334855.91_warc_CC-MAIN-20220926082131-20220926112131-00652.warc.gz\"}"}