How to Generate Random Numbers in C language using rand srand and time function



How to Generate Random Numbers in C language using rand srand and time function

How to Generate Random Numbers in C language using rand srand and time function

In this tutorial you will learn how to generate Random numbers using rand() srand() and time() functions in C Programming language.

In c language rand function is used for getting random numbers. To make sure that we get different sequence of random numbers for separate runs, we use srand function and pass the system time in seconds using time function.

To use rand and srand functions, we need to include stdlib header file and for getting time using time function we need to include time.h header file.

C Program to generate Random Numbers between a Range of Values
https://youtu.be/ZaZxHzRn-AY

For more tutorials visit our website
http://www.LearningLad.com

LearningLad in social media
Facebook https://www.facebook.com/LearningLad
twitter https://www.twitter.com/LearningLadEdu
Instagram https://www.instagram.com/LearningLadOfficial

Comments are closed.