Random weather | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Random weather

Can someone create a weather generator (Sunny, cloudy, clear, hot, windy, raining, sprinkling) That type

30th May 2018, 11:14 PM
Ddsjsa
Ddsjsa - avatar
5 Answers
+ 3
Well, you can put them in an array of strings. Then generate some random integers. Then use those random integers to index your array elements. Array's index starts from 0. For example if you had an array that contained five weather values. You could generate some integers from 0 to 4 (4 because array's index starts from 0, our final index will be 4) and use those integers in array object syntax to generate random weathers.
30th May 2018, 11:23 PM
xXx
xXx - avatar
+ 3
That was funny :D
30th May 2018, 11:44 PM
xXx
xXx - avatar
+ 2
i havent touched this app in a year, i cant remember how to set up shit let alone set up the generator
30th May 2018, 11:26 PM
Ddsjsa
Ddsjsa - avatar
+ 2
i know that i can use if and else if for the different elements not how to do the generator
30th May 2018, 11:29 PM
Ddsjsa
Ddsjsa - avatar
0
so, can you make it?
31st May 2018, 1:12 AM
Ddsjsa
Ddsjsa - avatar