C language in-depth learning

Source: Internet
Author: User

Random number:

//#include <stdlib.h>:rand, Srand//#include <time.h>:timeSrand0);p rintf ("%d\n", Rand ());//rand corresponds to Srand, and Rand's random values do not change as long as the seed of Srand remains unchanged; Rand's range is 0-int.Srand (Time (NULL)); Srand (unsigned) printf ("%d\n", Rand ());//The time function returns the current time (in seconds), and if the parameter param is not bull, it is assigned to Param. So the random number will always change (really random)printf"%d\n", rand ()% -+1);//Generate 1-100 Random number: rand ()% 100 is 0-99

C language in-depth learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.