UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
January
Su M Tu W Th F Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Sponsored Links
Latest Postings
也是福运似海、福运宏达的精神之源和力量之

by lmnopq127978
Today at 03:01 AM
饱餐大食
by lmnopq127978
Today at 03:00 AM
尊重任何人的选择
by lmnopq127978
Today at 03:00 AM
一直演进到篆书金文
by lmnopq127978
Today at 02:59 AM
里相思朋辈远
by lmnopq127978
Today at 02:59 AM
谁欠了谁一生的情
by lmnopq127978
Today at 02:58 AM
谁人之痛
by lmnopq127978
Today at 02:57 AM
【煦色韶华问佛】
by lmnopq127978
Yesterday at 03:38 AM
【听,梦里雪落的声音】
by lmnopq127978
Yesterday at 03:37 AM
那天,她留下了眼泪
by lmnopq127978
01/26/15 04:09 AM
Latest Reviews
Page 3 of 3 < 1 2 3
Topic Options
Rate This Topic
#17377 - 02/07/04 08:05 AM Re: First Program (What u think)
Red Mage Offline
Member

Registered: 10/24/03
Posts: 209
Loc: here.
Coleman: get to Dev C++ It's good

Ice: use something like this.. {variable = rand() % max;}
It'll give you a random number between 0 & "max"(which should also be replaced). I don't really know much about how it works, since I don't actually program in C++ :-D
_________________________
Those who say do not know.
Those who know do not say.

Top
Sponsored Links
      
#17378 - 02/07/04 12:26 PM Re: First Program (What u think)
vooduhal Offline
Junior Member

Registered: 01/02/04
Posts: 6
Loc: TN, USA
variable = rand() % max;

rand() produces a random integer value.
% is called the modulus operator. It's basically what you learned to be the remainder in division. Ie. 5 % 3 = 2 and 16 % 5 = 1
As for this function, it actually only returns a number from 0 to max - 1, as you can't divide a number by a number and have the remainder equal to the divisor. Ie. a % b cannot equal b.

Top
Page 3 of 3 < 1 2 3

Featured Member
Registered: 03/02/02
Posts: 136
Forum Stats
2153 Members
46 Forums
36676 Topics
71846 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 29822
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
claralobo, cdefgh368568, HushHush, golqm, Tim050
2152 Registered Users
Who's Online
1 registered (lmnopq127978), 230 Guests and 194 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!