Randomness in C works as follows: when the built-in random function is called, it returns a pseudo-random integer with an approximate range of 0 to 32000. Now, to get the number we need, we need to create a mathematical formula. For example, it's very convenient to take the remainder of a random number to get the desired range. The random number generator in C is very lazy and doesn't work quite correctly. If you run the program back-to-back, it won't generate anything and will always output the same number. In this video tutorial, we'll look at how to solve this problem using the built-in "srand" function.
Problems to be considered:
1) Using the random number generator, you need to output a random number between A and B. The range is entered from the console.
2) Given two numbers, you need to output a random number between 15 and 22.
C Language from Scratch Playlist • Язык си с нуля
Subscribe to the channel / @861