12/16/2023 0 Comments Random color codeGoing back to the random() function: remember that calling random() with no arguments returns a decimal number between 0 and 1. 5, and half of them will be greater than or equal to. In other words, of all the numbers you can pick between 0 and 1, half of them will be less than. If you drew a line at a point on the number line so that 50% of the numbers were on the left of the line and 50% of the numbers were on the right of the line, where would that line be? It would be 50% between 0 and 1, at. Let’s say you wanted to simulate something like a coin toss, where you flip a coin and have a 50% chance for it to land on heads, and a 50% chance to land on tails. Think about where these values would be on a number line: Remember that calling random() with no arguments returns a random decimal value between 0 and 1. The random() function can also be used with if statements to make random choices in your code. TVnh71REbs- Sunrise / Sunset Bot August 12, 2018 yxDbdcG8ye- Spotty McBotface August 21, 2018 This technique can be used to generate randomized art.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |