I was wondering if anyone knows a way to have a procedure happen exactly 50% of the time. I'm not taking about using prob(50) or pick(A,B) or whatever.
For example I'd like a projectile to move 2 steps, then create another object. Any ideas?
ID:155075
![]() Sep 26 2011, 12:51 pm
|
|
![]() Sep 26 2011, 1:04 pm
|
|
Modulus!
|
Kaiochao wrote:
Modulus! > for(var/n in 1 to 10) |
Check the DM Reference entry for the % operator. It simply gives the remainder of A divided by B.
In the example I provided, it checks if A%B is 0, which is the case in even numbers divided by 2. |
Kaiochao wrote:
Check the DM Reference entry for the % operator. It simply gives the remainder of A divided by B. Alright but not all even numbers divided by 2 equals 0 so the example doesn't really work unless I'm missing something. |
Robertbanks2 wrote:
Name a single even number that, divided by 2, leaves a remainder that is not 0. Sorry, I misunderstood. I saw the % operator as solely giving the quotient of two numbers. Then I read again and found that it gives the remainder. As for your example Kaiochao, it's correct. Thanks:) |