Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer for the C programming language. How can I make it so that I get different values each time the getRandomNumber function is called?

Please answer for the C programming language. How can I make it so that I get different values each time the getRandomNumber function is called? Each time it is called I get the same values and can not figure out how to get different values for each iteration of the for loop.

image text in transcribedimage text in transcribed

main.c (Ctrl+M) monsterbattle.c: monsterbattle.h! 1 #include #include 3 #include 4 #include "monsterbattle.h" 5 6- int getRandomNumber(int min, int max) { 7 int num; srand(time(NULL)); 9 rand()%(max-min+1) + min; 10 printf(" Min: %d, Max:%d, Rand generated: %d ",min, max, num); 11 return num; 000 W NP num = 12 13} 14 15 void fillRooms (Room *rooms, int length) { 16 int i; 17 - for(i = 0; i

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_2

Step: 3

blur-text-image_3

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

6. Describe turning points in intercultural friendships.

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago