C Primer Plus 第十二章第六題

6. Write a program that generates 1,000 random numbers in the range 1-10. Don’t save or print the numbers, but do print how many times each number was produced. Have the program do this for ten different seed values. Do the numbers appear in equal amounts? You can use the functions from this chapter or ANSI C rand() and srand() functions, which follow the same format that our function do. This is one way to test randomness of a particular random-number generator.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.