Random selection
From: JimT (someone_at_comcast.com)
Date: 11/23/04
- Next message: y sakuda: "Re: Random selection"
- Previous message: Ray Costanzo [MVP]: "Re: asp classic -- "html paragraph" format some raw text?"
- Next in thread: y sakuda: "Re: Random selection"
- Reply: y sakuda: "Re: Random selection"
- Reply: Hal Rosser: "Re: Random selection"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Nov 2004 18:27:32 -0800
I'm working on a script that requires the computer to chose a random number,
either 1, 2 or 3. I looked in a vbscript source book and it gives the
following example:
Randomize
GetRandomNumber = Int((3 * Rnd() + 1)
The author says the Rnd( ) function generates a random number between 0 and
1. The Int( ) function, which returns the integer portion of a number,
executes, multiplying 3 times the randomly generated number and then adds 1
to it. The final result is a randomly generated number with a value between
1 and 3.
If I do the math 3 times 0 is 0 and add 1 is 1. 3 times 1 is 3 plus 1 is 4.
Am I not understanding something in this equation? If not I would
appreciate an explanation. Thanks, Jim
- Next message: y sakuda: "Re: Random selection"
- Previous message: Ray Costanzo [MVP]: "Re: asp classic -- "html paragraph" format some raw text?"
- Next in thread: y sakuda: "Re: Random selection"
- Reply: y sakuda: "Re: Random selection"
- Reply: Hal Rosser: "Re: Random selection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|