answersLogoWhite

0

QBASIC CODE/EXAMPLE 1: WITHOUT 'RANDOMIZE' statement:-

====

RANDOMIZE TIMER

CLS

FOR eachDiceThrow% = 1 TO 10

diceNo% = INT(RND * 6) + 1

PRINT diceNo%; " ";

NEXT

END

=====

...output...

5 3 6 3 1 3 6 1 1 6

...re-RUN/output...

6 2 6 5 1 4 1 5 6 5

As you can see from the above 2 code examples. When we don't use the RANDOMIZE statement; then, each time we run the program...the sequence of random numbers that gets produced...is always in the same 'fixed' order as went before.

But, when we do use the RANDOMIZE command statement; then, each time the sequence of random numbers being produced is entirely 'different'.

NOTE: The statement, RANDOMIZE TIMER, is used to 'seed' the QBASIC random number generator; by selecting a random number to start the sequence of numbers off with which is based on your current computer clock time.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Do you need statement numbers in QBASIC?

Statement numbers were a feature of BASIC, and while QBASIC supports them, they are by no means necessary.


What extension would a file saved in Qbasic have?

the extensions of qbasic are that, there are only 80 pixels to write in the qbasic


Why are rem statements important in qbasic programming?

qbasic is important because its technology


What is the difference between the functions rand random srand and randomize?

RAND: Rand uses a multiplicative congruential random number generator with period232 to return successive pseudo-random numbers in the range 0 to RAND_MAX. Return Value: Rand returns the generated pseudo-random number. RANDOM(): Random returns a random number between 0 and (num-1).random(num) is a macro defined in STDLIB.H. RANDOMIZE(): Randomize initializes the random number generator with a random value. Because randomize is implemented as a macro that calls the time function prototyped in TIME.H, you should include TIME.H when you use this routine SRAND(): The random number generator is reinitialized by calling srand with an argument value of 1.The generator can be set to a new starting point by calling srand with a given seed number.


How do you randomize your Pokemon emerald ROM?

There is a Java program that you can download that will randomize your pokemon games. The randomizer allows you to randomize all of the main series games up to Black and White 2. To learn more search Universal Pokemon Randomizer.


How do you get a randomize code for diamond?

U dont


What are the difference between gwbasic and qbasic?

Difference between QBASIC and GWBASIC?


What is the shortcut key for input statement in QBasic?

There is no shortcut key of input in qbasic


What are the different types of operators in QBASIC?

The different types of operators in QBASIC are:Arithmetic OperatorsRelational OperatorsLogical Operators


How do you check a prime number in qbasic?

Cls input "enter the no. You want to check", a if a <=0 then print "only natural nos allowed" if a <=0 end let m = a - 1 for i = m to 2 step -1 if a mod i = 0 then print "not prime" if a mod i = 0 then end next i print "prime" end


Why is QBasic called QuickBasic?

Qbasic and Quickbasic are not the same! Qbasic was a free interpreter that Microsoft included with MS-DOS. Although Quickbasic uses similar syntax as quickbasic it allows programs to be compiled.


Who found QBASIC?

microsoft