VOGONS

Common searches


First post, by raymond

User metadata

Hello,

I have a question regarding generating pseudo random numbers with help of the system itself (operating system or BIOS interrupt vector).

Is there a feature in BIOS of DOS to generate pseudo random numbers? If so it may be missing from DOSBOX.

The reason why is this: the game "titus the fox" generates random passwords for each level, probably with a pseudo random generator with the same initial seed, but these passwords seem to be dependant on the hardware somehow. ie. level codes differed from system to system when i played the game on a real DOS machines years ago. in other words, level passwords are not swappable.

But in DOSBOX, this random number generator doesn't work, at least in that game. Every level password is '0000'.

That's pretty inconvenient but i have no other software to check wether it's really a flaw of this particular game or wether it's some kind of bug.

I don't know exactly wether this question belongs to "apps/games" but i have the idea that this may be a general problem.

Is this a known problem?

Thanks in advance,

Raymond D. from Holland.

Reply 1 of 5, by mirekluza

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

There are many different ways how random numbers can be generated. So from the fact that it does not work in one case it is not possible to judge other cases.

Mirek

Reply 2 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Some randomness exist. I created this little QBASIC program and ran it with DOSBox:

10 RANDOMIZE TIMER
20 FOR I=1 TO 10
30 PRINT RND(1)
40 NEXT

and I got 10 different, random numbers between 0 and 1.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 3 of 5, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

They use rom data to randomize some values (second game
after the static noise in the ultima7 intro).
As dosbox has zeros there the generator doesn't work.

Occurs in the subroutine at 0xeb:0x36c, uses memory
at 0xf000:0xfff0 (reset jump) and the hma.

wd

Reply 4 of 5, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

MiniMax: That's totally different. The RANDOMIZE command picks/sets a seed which is used as a starting point into a gigantic, repeating list of random numbers. The list actually exists as a forumula or algorithm rather than an actual list, but the effect is the same. In your code, the system timer (usually containing something like the number of seconds since midnight) is being used as a seed for the RANDOMIZE command. If you replace "TIMER" with the number zero, you'll see the same 10 numbers every time. This is because the program will start picking numbers from spot number zero in its "random number list".

it's also worth noting that in QBASIC and most other programming languages, the random number generator is implemented in software.

I just used Google really quickly to dig up a site that talks about random number generator algorithms. It's a bit technical and is talking about some specific library for the first half (so skip down a ways):
http://www.gnu.org/software/gsl/manual/gsl-ref_17.html

Reply 5 of 5, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

MiniMax just wanted to say that there is no bios-call
that generates random values but it is up to the program
to do so (where qbasic succeeds because it uses the timer
as seed and titus fails).

wd