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?
a) Every number has an equal chance of being chosen at any time.
b) Why is the rand function useful for simulating games of chance?
c) The sequence of numbers produced by the random number generator differ each
time function srand is called. Not randomizing is useful for debugging purposes—
the programmer knows the sequence of numbers.
d) To produce random values in a specific range.
e) It enables more accurate predictions of random events such as cars arriving at a toll booth, people arriving in lines, birds arriving at a tree, etc. The results of a simulation can help determine how many toll booths to have open or how many cashiers to have open at specified times.
You might also like to view...
Viruses needs human action to spread.
Answer the following statement true (T) or false (F)
The approach known as the avoidance strategy is more properly known as the __________ risk treatment strategy.
Fill in the blank(s) with the appropriate word(s).
________ computers are able to continue their operation even when problems are present.
A. DSS B. Fault-tolerant C. Uninterruptable D. Scalable
____ offer the visitor a broad range of content.
A. Personal portals B. General consumer portals C. Horizontal portals D. Industry portals