Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Generate random numbers in C! ๐ŸŽฒ
Play lesson

C tutorial for beginners โš™๏ธ - Generate random numbers in C! ๐ŸŽฒ

4.0 (0)
13 learners

What you'll learn

This course includes

  • 6.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#coding #programming #cprogramming int main() { // Pseudo-random = Appear random but are determined by a // mathematical formula that uses a seed value // to generate a predictable sequence of numbers. // advanced: Mersenne Twister or /dev/random srand(time(NULL)); // Sets the seed based on current time int min = 1; int max = 100; int randomNum1 = (rand() % (max - min + 1)) + min; int randomNum2 = (rand() % (max - min + 1)) + min; int randomNum3 = (rand() % (max - min + 1)) + min; printf("%d %d %d", randomNum1, randomNum2, randomNum3); return 0; }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere