0
Question about Math.random
How do you get a random number between -100 and +100?
5 Antworten
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 yea sure but i am still in the beginning of learning programming.. so i don't understand your answer with random import randint and stuff 😅😅😅
+ 1
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Martin Taylor And what about creating a second Math.random and subtract it with the first Math.random? Would it be a legit opportunity?
+ 1
Because I had an exam today and the question was how do u get random numbers between -100 and +100
And my answer was that u could generate a second Math.random and subtract them
+ 1
number = Math.random()*200 - 100;
+ 1
Ohhh ok now i understand, thank you very much, now i realize that my answer in the exam was wrong 😅
That makes perfectly sense
And yea sorry i forgot to include the language, thanks for the advise 😉 Martin Taylor