Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Random number generator is widely used in scientific researches. The C++ language itself has a random number generator called rand(), which is defined in

image text in transcribed

c++

Random number generator is widely used in scientific researches. The C++ language itself has a random number generator called rand(), which is defined in the preprocessor directive cstdlib. This function rand) generates values in range [O RAND_MAX] in a random order. However, in real applications, it is quite often that random values in a specific range are required. You are asked to write a function that returns random a value in the range specified by its two parameters a and b. Your function should be declared with the header int RandIntAB( int a, int b). You are then asked to call this function to generate 20 random integers of the range [min max] and put them on the terminal window. These 20 values have to be aligned into 4 rows 5 columns. The min and max are integers obtained from the keyboard provided by users. The following figure shows what you will see on the screen when you execute the program. What the range of the random numbers should be in? [min max]: 45 90 62 58 72 75 57 53 89 63 70 62 81 80 51 53 82

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions