I didn't know how to report a bug to the GW-BASIC folks, but TK Chia hangs
out on this list, so I thought I'd mention it here.

I noticed TK Chia released a new GW-BASIC the other day. I started playing
around with it, just writing a few simple BASIC programs. I think I found a
bug:

RND(1) should always generate new random numbers. GW-BASIC resets the
sequence every time you RUN a program. So you were supposed to seed the
random number generator with the RANDOMIZE statement, passing a value as
the seed.

To have RANDOMIZE use an internal timer as the seed, you can add the TIMER
keyword:

RANDOMIZE TIMER


But this GW-BASIC seems to treat "TIMER" as a variable, so it's the same as
typing:

RANDOMIZE 0

or any uninitialized variable: (which are set to zero)

RANDOMIZE VAL

However, a workaround is to use the value from the system time (TIME$) and
use only the seconds. You can do that with the MID$() function.

LET SEED = VAL(MID$(TIME$,7,2))

That picks up only the seconds from the system time.


I found a copy of the GW-BASIC manual at
https://hwiegman.home.xs4all.nl/gw-man/
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to