Egoboo Forum

The Legend of Egoboo Sporks of Yore
The Deamon Lord Boss
Goto page Previous  1, 2, 3 ... 13, 14, 15
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Egoboo Forum Forum Index -> -> Game Discussion
View previous topic :: View next topic  
Author Message
bgbirdsey
Developer
Developer


Joined: 25 Sep 2007
Posts: 873
Location: Minnesota

PostPosted: Fri May 30, 2008 11:59 pm    Post subject: If a post contains some illegal issues you may abuse on it - just click Abuse and fill the form Reply with quote

Quote:
rand & 2 generates a number between 0 and 2.


GARRRR! The & is a bitwise operator. If you misuse it, have a lapse in judgement, or don't understand binary it is better to use the % operator instead.

    rand % n generates a number between 0 and n-1



here is simple table of the results of using rand and &

    rand & 1 generates a random number between 0 and 1.
    rand & 3 generates a random number between 0 and 3.
    rand & 7 generates a random number between 0 and 7.
    rand & 15 generates a random number between 0 and 15.
    rand & 31 generates a random number between 0 and 31.
    rand & 63 generates a random number between 0 and 63.
    rand & 127 generates a random number between 0 and 127.
    rand & 255 generates a random number between 0 and 255.
    rand & 511 generates a random number between 0 and 511.

and so on

r
    and & 2 generates EITHER 0 or 2
    rand & 4 generates EITHER 0 or 4
    rand & 8 generates EITHER 0 or 8
    rand & 16 generates EITHER 0 or 16
    rand & 32 generates EITHER 0 or 32
    rand & 64 generates EITHER 0 or 64

and so on
Back to top
View user's profile Send private message
Clonkinator
Master Frying Pen (Moderator)
Master Frying Pen (Moderator)


Joined: 03 Nov 2007
Age: 26
Posts: 3076
Location: Germany

PostPosted: Sat May 31, 2008 7:20 am    Post subject: If a post contains some illegal issues you may abuse on it - just click Abuse and fill the form Reply with quote

penguinflyer2222 wrote:
On page one I noticed that Zefz and AoD double posted.

It's right that there are two posts in a row from them but they're all several days apart from each other; after about 24 hours it's not really called double-posting anymore. Thanks for saying it though. Smile
(However, since such stuff usually is off-topic, please just PM me about it next time)
_________________
Yes, it's true. I fail. Epicly so.
Back to top
View user's profile Send private message Send e-mail
PurpleSquerkle
Supreme Cookiemancer
Supreme Cookiemancer


Joined: 28 Oct 2007
Age: 28
Posts: 4370
Location: Midwestern US

PostPosted: Sat May 31, 2008 2:51 pm    Post subject: If a post contains some illegal issues you may abuse on it - just click Abuse and fill the form Reply with quote

Also, this is a pretty old thread.
We were way more lenient back when there were only five or six active members.

bgbirdsey wrote:
Quote:
rand & 2 generates a number between 0 and 2.


GARRRR! The & is a bitwise operator. If you misuse it, have a lapse in judgement, or don't understand binary it is better to use the % operator instead.

    rand % n generates a number between 0 and n-1



here is simple table of the results of using rand and &

    rand & 1 generates a random number between 0 and 1.
    rand & 3 generates a random number between 0 and 3.
    rand & 7 generates a random number between 0 and 7.
    rand & 15 generates a random number between 0 and 15.
    rand & 31 generates a random number between 0 and 31.
    rand & 63 generates a random number between 0 and 63.
    rand & 127 generates a random number between 0 and 127.
    rand & 255 generates a random number between 0 and 255.
    rand & 511 generates a random number between 0 and 511.

and so on

r
    and & 2 generates EITHER 0 or 2
    rand & 4 generates EITHER 0 or 4
    rand & 8 generates EITHER 0 or 8
    rand & 16 generates EITHER 0 or 16
    rand & 32 generates EITHER 0 or 32
    rand & 64 generates EITHER 0 or 64

and so on


OK, so what does "rand & 1000" do, exactly?
Either 0 or 1000?
Hmm. Interesting.

I might have to keep working and see if I can get something even better, then.
_________________

+ PurpleSquerkle

--My website--
Latest update= 7/15/08; Three new midi loops.

{new Squerkle coming as soon as I stop being lazy}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Zefz
Lead Designer
Lead Designer


Joined: 16 Sep 2007
Posts: 2306
Location: Norway

PostPosted: Sat May 31, 2008 4:45 pm    Post subject: If a post contains some illegal issues you may abuse on it - just click Abuse and fill the form Reply with quote

Thats why I suggested using rand & 1023

And I was a little confused when you said it did not work properly.
_________________
http://egoboo.sourceforge.net

"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword."
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
PurpleSquerkle
Supreme Cookiemancer
Supreme Cookiemancer


Joined: 28 Oct 2007
Age: 28
Posts: 4370
Location: Midwestern US

PostPosted: Sat May 31, 2008 5:20 pm    Post subject: If a post contains some illegal issues you may abuse on it - just click Abuse and fill the form Reply with quote

It doesn't!
Seriously, try it.
It just doesn't work.

What's another good one I could use?
_________________

+ PurpleSquerkle

--My website--
Latest update= 7/15/08; Three new midi loops.

{new Squerkle coming as soon as I stop being lazy}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Egoboo Forum Forum Index -> -> Game Discussion All times are GMT
Goto page Previous  1, 2, 3 ... 13, 14, 15
Page 15 of 15

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


© 2007 Informe.com. Get Your Own Free Portal.
Powered by phpBB © 2001, 2005 phpBB Group


RedSilver 1.01 Theme was programmed by DEVPPL HTML Forum
Images were made by DEVPPL Photoshop Forum