QB / QB64 Discussion Forum      Other Subforums, Links and Downloads
 Return to Index  

This is the start

April 12 2012 at 2:02 PM
AlGoreIthm  (Login AlGoreIthm)


Response to Re: Mathematical exclusion from a random function - Can it be done?

Michael's post inspired this idea of how to begin modifying the 2nd Random value line. This is only a start, and without extensive testing, appears to reliably change the range of the second value if the first value is either the lowest or the highest possible. Now ... back to work on everything else in the middle ...


================================================================================
minimum% = 9
maximum% = 18

first% = INT(RND * (maximum% - minimum% + 1)) + minimum%

second% = INT(RND * (maximum% + (first% = maximum%) - minimum% + 1)) + minimum% + ABS(first% = minimum%)

 
 Respond to this message   
Responses