Sgledhill5 wrote:Are there any Qbasic Programmers who can provide me with a subroutine for adding random generated numbers, thanks
DECLARE FUNCTION RandInt% (Lower, Upper)
RANDOMIZE TIMER 'Put this at the top of your program to seed the RND function.
' =============================== RandInt% ===================================
' Returns a random integer greater than or equal to the Lower parameter
' and less than or equal to the Upper parameter.
' ============================================================================
'
FUNCTION RandInt% (Lower, Upper) STATIC
RandInt% = INT(RND * (Upper - Lower + 1)) + Lower
END FUNCTION
NOTES AND QUESTIONS:
1) The above function will work easier than a subroutine.
2) The way the function is set up, the maximum random number is 32767, that is, an integer.
3) You will need to set up the Lower and the Upper parameters.
4) How do you want to handle duplicate random numbers, process them or eliminate them?
5) What do you mean by ADDING random generated numbers? Adding them together, adding them to an array?
Regards..... Moneo