physics chemistry maths science forums
become expert I help I sign up I login
refer a friend - earn nickels!!   
 advanced
 
Home
Ask & Discuss Questions
Study Material
Experts Zone
Hang Out!

Ask & Discuss Questions with Community & Experts

Moderation Team
 90 chars left    advanced
Ask iit jee aieee pet cbse icse state board community Community Discussion Question: C++
Forum Index -> Computer Science like the article? email it to a friend.  
Author Message
Mandy_12_91 (32)

Cool goIITian

Olaaa!! Perrrfect answer. 6  [7 rates]

Mandy_12_91's Avatar

total posts: 49    
offline Offline
How to use randomizer funtion to generate random nos?

Live life king size
    
sagarvaze (253)

Scorching goIITian

Olaaa!! Perrrfect answer. 39  [68 rates]

sagarvaze's Avatar

total posts: 287    
offline Offline
use rand function like

int a=rand()

to get numbers in a range say 0 to 9

int a=rand() % 10

you need cstdlib for this





 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
Selvaganesh_i (268)

Hot goIITian

Olaaa!! Perrrfect answer. 46  [65 rates]

Selvaganesh_i's Avatar

total posts: 135    
offline Offline
int x = rand(n);

the above function generates a random number from
0 to (n-1)

The function is defined under "stdlib.h"




 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
 
Forum Index -> Computer Science
Go to:   

Top Offers for goIITians
Correspondence Courses
Brilliant Tutorials
Narayana Institute
Aakash Institute
Classroom/Crash Courses
Narayana - Kota , Delhi , Others
Brilliant Tutorials - Class , Crash
Aakash Institute - Medical , Engg
Online Test Series
Brilliant Tutorials
Narayana Institute
Aakash Institute
Mahesh Tutorials
AMITY      Sri Chaitanya