assignment23-new

assignment23-new - Built in functions Assignment 23 There...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Built in functions Assignment 23 There is a built­in funct ion called rand which returns a pseudo­rando m number. The problem is that the range of that number is often too large to be the kind o f rando m numbers we need. For example, we might want a number from 1 to 100, but the rand funct ion gives us numbers way out of that range. Write a program that generates 10 pseudo­random numbers between 1 and 100 and displays them on the screen. Note: you can not just keep generating them and throwing them away if they are out of range. Also note: if you use the modulus operator (%) you will be able to figure this out. The fo llo wing is an example – your answers will probably be different. ...
View Full Document

This note was uploaded on 01/11/2010 for the course CMPSC 101 taught by Professor Drobish,renee during the Summer '07 term at Penn State.

Ask a homework question - tutors are online