We are about to switch to a new forum software. Until then we have removed the registration on this forum.
In this part of the code, you can see that it will generate circles with radii between 10 and 30. How can I make it so that it will only generate circles with radius 10 and 30 not the range?
Answers
r = 10
If random number > .5 then r = 30
Can you explain a bit more, @koogs? I'm new to js.
You want to get two values randomly.
What koogd did: radius 10 is the default so to speak.
In the 2nd line he generates a random number (between 0 and 1) and at the same time asks it wether it is bigger than 0.5 using
if
. This applies to 50% of the cases statistically.When the condition is met (keyword
then
) the default r is changed to 30.So you end up with either 10 OR 30.
Thank you, @Chrisir !