QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

HomeNewsGitHubWikiSamplesInFormGXQBjsCommunityMore…

SAMPLE: QBRND

screenshot.png

Author

🐝 Jeff Davis

Description

' QBRND.BAS
'   by Jeff Davis
' Copyright (C) 1994 DOS Resource Guide
' Published in Issue #15, May 1994, page 64

***************************************************************************** 
 
 QBRND.BAS 
   by Jeff Davis 
 Copyright (C) 1994 DOS Resource Guide 
 Published in Issue #15, May 1994, page 64 
 
Many QBasic programs, especially games, involve generating random numbers.   
This program handles a variety of random number tasks, and you may want  
incorporate its techniques and subroutines in your own programs. 
 
QBRND.BAS is capable of generating random lotto numbers, generating a  
tournament draw, determining a draft order at random, choosing bingo numbers,  
and more. 
 
To run the program from the DOS command line, change to the directory  
containing QBRND.BAS, then type: 
 
QBASIC /RUN QBRND 
 
 
Instead of limiting the number choices to a range, such as 1 to 100, the  
program asks for the size of the sample and then asks how many times you wish  
to draw from that sample. For a lottery, for instance, you might enter 49 as  
the sample size and 6 as the number of draws; for bingo, good values might be  
75 and 75.

QBjs

Please note that QBjs is still in early development and support for these examples is extremely experimental (meaning will most likely not work). With that out of the way, give it a try!

File(s)

🔗 statistics, dos world