Print Friendly and PDF
(Short Answer Questions) Answer each of the following questions: a) What does it mean to choose numbers “at random?” b) Why is the rand function useful for simulating games of chance? c) Why would you randomize a program by using srand? Under what circumstances is it desirable not to randomize? d) Why is it often necessary to scale or shift the values produced by rand? e) Why is computerized simulation of real-world situations a useful technique?
(Short Answer Questions) Answer each of the following questions:

a) What does it mean to choose numbers “at random?”

b) Why is the rand function useful for simulating games of chance?

c) Why would you randomize a program by using rand? Under what circumstances is it

desirable not to randomize?

d) Why is it often necessary to scale or shift the values produced by rand?

e) Why is computerized simulation of real-world situations a useful technique?

Solution:

a) It means that any number has an equal chance of being selected.

b) It is useful because you can call on it to generate any number range where any number in the range has an equal or fair chance of coming up in play.

c) Because the numbers generated by the function are from 0 < x < 1, and that range may not be useful to the game's requirements.
d) t allows for safe testing of hypothesis and can broaden the possibilities of the real-life situations by allowing for quicker discovery.
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: