Well just wondering how I would put this into BYOND language.
B = (int(D/4)%255)
Let me know if any of you knows, I dont know any other languages and really got no idea what to do with the "%"
And sinces this aint really BYOND language nor a code problem I've wacked it down here.
Thank you!
- Fint
ID:183622
Jun 9 2007, 10:02 pm
|
|
Jun 9 2007, 10:09 pm
|
|
b = (round(d/4))%255
|
In response to Xx Dark Wizard xX
|
|
Ah, darn I've been coding for quite some years on BYOND and just now i discover the following.
%: The remainder of A / B Thanks for pointing me into the right direction! |
In response to Fint
|
|
It's called 'modulus'. Most programming languages with C-derived syntax (Java, C++, D, Python) would use % for that.
|
In response to Jp
|
|
It's actually an extremely convenient operator once you get used to it.
|
In response to Rockinawsome
|
|
Rockinawsome wrote:
It's actually an extremely convenient operator once you get used to it. Good for making random numbers in C++ |
In response to Shlaklava
|
|
And other uses as well:
if(round(rand()*100)%2)world<<"The number is odd because an even number is divisible by 2 making the remainder always 0." |
In response to Shlaklava
|
|
Good for making random numbers in any language. The Mersenne Twister is based around the whole linear-congruential-generator thing.
|