www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/09/16:31:09

From: Dan <dyoon AT home DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro ex11.c
Date: Mon, 09 Feb 1998 13:18:12 -0800
Organization: @Home Network
Lines: 13
Message-ID: <34DF7294.21D0@home.com>
Reply-To: dyoon AT home DOT com
NNTP-Posting-Host: cc104221-a.bnapk1.occa.home.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

i have a question concerning a part of the code from the allegro example
files.  it's probably a stupid question but i've looked in my c and c++
books and i can't find the answer.  here's the question, in this small
snippet of the code..

      hotspot[c] += (random() & 7) - 3;

what does "random() & 7" do?  i'm figuring random() returns a random
# of type int maybe?  but i have no idea what the "& 7" does.  the & 7
is the only thing that i need an explenation for.  any help would be
much appreciated.

Daniel

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019