Srand Time Null Dev C%2b%2b
Srand Time Null Dev C 2b 2b 2
Rand The rand function is used in C/C to generate random numbers in the range 0, RANDMAX). Note: If random numbers are generated with rand without first calling srand, your program will create the same sequence of numbers each time it runs. Output: Time taken by C qsort - 0.247883 Time taken by C sort - 0.086125. C sort is blazingly faster than qsort on equivalent data due to inlining. Sort on a container of integers will be compiled to use std::less::operator by default, which will be inlined and sort will be comparing the integers directly.On the other hand, qsort will be making an indirect call through a. Random numbers can be generated in C using the rand function. The srand function seeds the random number generator that is used by rand. A program that uses rand and srand is given as follows −.
Srand Time Null Dev C 2b 2b C
friends...i have got a doubt...
how to use srand() function. how to define the seed for this.
suppose i want to generate a random number between 0 and 10. then what seed should i use...
though rand() function works fine....i just wanted to know the difference beween srand() and rand()...
_____________________________________________________________
Get email for your site ---> http://www.everyone.net
_____________________________________________________________
Select your own custom email address for FREE! Get ***@yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag