[Solved] Why does always one image doesn't show up?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

[Solved] Why does always one image doesn't show up??

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

15th Jun 2021, 5:41 AM
Shobhit :)
Shobhit :) - avatar
6 Answers
+ 6
because you use ceil() on random number generator, while you must use floor(): Math.random return a float between 0 (inclusive) and 1(excluded), so ceil() return int between 1 to 6 (both inclusives) while you need 0 to 5 (zero based indexes)... tips: using bitwise OR operator get almost the same result as floor() (for numbers lesser than 2 ^32) num = Math.random()*6 | 0; (precedence of operators allow to spare parenthesis)
15th Jun 2021, 6:27 AM
visph
visph - avatar
+ 3
Looper🐼 🇮🇳 are you kiding? you just use the tip I given in my post, without removing the ceil() function: its unuseful as equivalent to ceil() an int, or ceil() a floored value...
15th Jun 2021, 7:42 AM
visph
visph - avatar
+ 3
Looper🐼 🇮🇳 what are you talking about man? you said visph was a dumb programmer just because he said they work on his device? he also suggested a solution to a problem that he didn't even exprience. saying that he is dumb just because you didn't understand what he was talking about, is kinda ironic.
16th Jun 2021, 5:11 AM
Bot
Bot - avatar
+ 2
visph Thank you so much sir for helping 🤗🤗
15th Jun 2021, 7:23 AM
Shobhit :)
Shobhit :) - avatar
+ 2
Looper🐼 🇮🇳 all image links of OP code perfectly works on my side ^^ and if I have noticed problems I maybe (offtopic regarding the question) have suggested to not use images but draw dice faces with html... rather than using url of images wich fit less good than original ;P anyway, I never claimed for "copyright patent tip", I just said that you doesn't give anything new, even more you let some unuseful stuff...
15th Jun 2021, 9:42 AM
visph
visph - avatar
+ 2
visph thanks for your suggestion 🤗🤗
15th Jun 2021, 10:35 AM
Shobhit :)
Shobhit :) - avatar