+ 72

@vitya how did you generate the random numbers?

https://code.sololearn.com/Wd7S3ZbybqK7/?ref=app

13th Dec 2019, 9:49 PM
Cozmo G from outer space
Cozmo G from outer space - avatar
76 Antworten
+ 44
Well I used Math.random() method together with Math.round() method. A multiplier is used to define the maximum value of the generated number. Those are 3 things required to do that. This is how it works. Math.random() generates a long decimal number. It's not truly random, but it's unpredictable so one can call it "random". However, I don't need the precision of a long decimal so I use one of the method to round the number. In that code I used Math.round() method, which rounds the number up. Math.floor() method can be used instead of Math.round(), but it rounds the number down. Math.ceil() is similar to Math.round(). It also rounds the number up.
13th Dec 2019, 9:52 PM
🇺🇦 Vitya 🇺🇦
🇺🇦 Vitya 🇺🇦 - avatar
+ 56
Vitya Thanks for your help👍😁😁!!!
13th Dec 2019, 9:54 PM
Cozmo G from outer space
Cozmo G from outer space - avatar
+ 37
"I set the browser to accept all cookies" It's show and tell time. I decided to visualize my explanation of creating random numbers. For that I reworked the prototype code, added more controls and ways to get a random number. I hope it will help you understand this topic better. Have fun with it! https://code.sololearn.com/Waji2iM7FwNj/?ref=app
26th Dec 2019, 9:50 PM
🇺🇦 Vitya 🇺🇦
🇺🇦 Vitya 🇺🇦 - avatar
+ 10
Mohammad Naveeth you know that's probably a fake account you're talking to rignt?
1st Mar 2022, 9:41 PM
Cozmo G from outer space
Cozmo G from outer space - avatar
+ 9
Hey sir in python you can use for loop for that
14th Mar 2020, 4:25 AM
Twinkal meshram
Twinkal meshram - avatar
+ 1
Hello How old are you
25th Feb 2022, 11:53 AM
Kate Dambar
Kate Dambar - avatar
+ 1
Ok tq
2nd Mar 2022, 1:40 AM
Mohammad Naveeth
+ 1
Cozmo G from outer space Are you crazy ?
3rd Mar 2022, 8:37 AM
Kate Dambar
Kate Dambar - avatar
+ 1
Sorry kate dambar no matter
4th Mar 2022, 7:37 AM
Kate Dambar
Kate Dambar - avatar
+ 1
Can you please help me to learn c++ Ok
4th Mar 2022, 7:38 PM
Kate Dambar
Kate Dambar - avatar
0
19
25th Feb 2022, 2:59 PM
Mohammad Naveeth
0
Hello
25th Feb 2022, 3:06 PM
Mohammad Naveeth
0
What question
25th Feb 2022, 3:06 PM
Mohammad Naveeth
0
What do you say? Where are you from?
25th Feb 2022, 3:08 PM
Kate Dambar
Kate Dambar - avatar
0
I am from India
25th Feb 2022, 3:18 PM
Mohammad Naveeth
0
Am I talking to you?
25th Feb 2022, 3:18 PM
Kate Dambar
Kate Dambar - avatar
0
Yes I think
25th Feb 2022, 3:20 PM
Mohammad Naveeth
0
Kate dambar
25th Feb 2022, 3:20 PM
Mohammad Naveeth
0
Are you crazy?
25th Feb 2022, 3:21 PM
Kate Dambar
Kate Dambar - avatar
0
Have you ever traveled to America?
25th Feb 2022, 3:21 PM
Kate Dambar
Kate Dambar - avatar