|
|
|
|
|
by acegopher
4543 days ago
|
|
Right, the reason it won't ever emit F is because RND(1) will never return 1, it's implementation will return 0<=X<1, and INT() is a truncation, so INT(RND(1) + 15) will return an integer between 0 and 14. Adding one gives 1 to 15, and since F is in the 16th position of the string (Apple BASIC indexed from 1, not 0) it will never get selected. |
|
INT(RND(1) * 15), in contrast will produce a random whole number from 0 to 14. Hence the popular use of, for example, INT(RND(1) * 6)+1 in any given situation where a random number between 1 and 6 is required.