CMPSC 16 Lecture Notes - Lecture 14: Binary Search Algorithm
Document Summary
To generate random numbers, need to include the library Use the command rand()" to generate a random number. Std:: scope operator: have to use when the using namespace std;" is not used or when writing functions that are already in the standard namespace. Rand() % 100 : returns a random number from 1 - 99. If you want the random numbers to be different each time, then you have to seed the random number generator each time differently. The seed is what is used to generate the sequence of random numbers. Usually use the time to seed the random number generator because time always changes. Have to import the in order to use the time. When you define using the standard library, it becomes an object. Using auto (c++11), then the loop figures out the type that it is. To compile using c++11, use the command g++ --std=c++11 filename".