Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
avoskov

15.12.2025, 00:12
 

SmokeRand: new test suite for pseudorandom numbers generators (Announce)

Hello!

I've created SmokeRand: a new cross-platform test suite for 32-bit and 64-bit pseudorandom number generators written in C99 (MIT license). It combines ideas from TestU01, PractRand and gjrand and includes four predefined general purpose batteries, ~250 PRNG examples and several pre-defined heuristic scoring for tested PRNGs. The batteries is much more sensitive than DIEHARD or even Diehader and closer to TestU01 and PractRand.

Two interfaces for generators are supported: either stdin/stdout or plugins. In DOS the most reliable method would be plugins.

Three compilers are supported for DOS:

1. Open Watcom C v2, the makefile for WMake can be obtained by running the Lua scripts supplied with SmokeRand. Plugins with PRNGs will be compiled as freestanding DLLs for 32-bit Windows NT and the simplified custom DLL loader will be used to load them under DOS extender.

2. DJGPP: Makefile.gnu contains an experimental support of this compiler. Plugins will be compiled as DXE modules.

3. Any 16-bit C90 compliant compiler a for simplified "express" battery (see "apps/sr_tiny.c"): autogenerated makefile for Open Watcom C builds such version too. Of course, it may be slow on real 16-bit computers and take minutes and even hours.

There is one problem: all batteries except express are memory hogs that will require at least 512 MiB or RAM, they will also be slow on older computers. It can be partially solved by customization of batteries that can be made even without recompilation. Also 32-bit DOS version will try to use RDTSC instruction for performance measurements.

Repo with source code: https://github.com/alvoskov/SmokeRand

Rugxulo

Homepage

Usono,
15.12.2025, 05:34

@ avoskov
 

SmokeRand: new test suite for pseudorandom numbers generators

> I've created SmokeRand: a new cross-platform test suite for 32-bit and
> 64-bit pseudorandom number generatorses.
>
> Also 32-bit DOS version will try to use RDTSC instruction for performance measurements.

You can also use newer RDTSCP if available.

avoskov

15.12.2025, 08:53

@ Rugxulo
 

SmokeRand: new test suite for pseudorandom numbers generators

> You can also use newer
What it is advantage of RDTSCP over RDTSC? I use this instruction only in one-threaded mode to either measure performance or collect some entropy. I optionally use other newer instruction - RDSEED, but only in DJGPP, I've not added it in Open Watcom version. I use RDSEED and RDTSC also as fallbacks for platforms without system CSPRNG such as DOS to generate a seed for the internal Blake2s + ChaCha20 seeder.

Rugxulo

Homepage

Usono,
15.12.2025, 11:22

@ avoskov
 

SmokeRand: new test suite for pseudorandom numbers generators

> What it is advantage of RDTSCP over RDTSC?

Not entirely sure. It's newer (circa 2010?) and better somehow (SMP?). Honestly, they say it's not enough but apparently needs help from LFENCE/MFENCE and/or (Intel only) SERIALIZE. Lots of talk about out-or-order and how it's only partially serializing.

IIRC, DJGPP's uclock() in libc tries to use RDTSC and catches SIGILL if not available.

avoskov

15.12.2025, 12:06

@ Rugxulo
 

SmokeRand: new test suite for pseudorandom numbers generators

> Lots of talk about out-or-order and how it's only partially serializing.
I don't use RDTSC for microbenchmarks, intervals between their calls for performance measurements are about 0.1-1 second. And for entropy pool filling "partially serializing" is actually an advantage because it gives a slight undeterminism.

By the way, do CSPRNGs for DOS exist?

Back to index page
Thread view  Board view
22970 Postings in 2154 Threads, 403 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum