How do I get random #s?

Art Boyne boyne at hplvli.HP.COM
Sat Feb 18 00:35:57 AEST 1989


albaugh at dms.UUCP (Mike Albaugh) writes:

>From article <5260010 at hplsla.HP.COM>, by jima at hplsla.HP.COM (Jim Adcock):
>> For example, we frequently use random numbers to test software,
>> using the random numbers to choose from the various commands that
>> our software implements, with randomly selected parameters,
>> in random order.  Its very nice to use this technique to 
>> find software bugs, fix the bugs, then re-run the random command
>> generator software with the same seed as a regression test.
>> Can't do this with a combined hardware/software scheme.
>
>	I would think that a better approach would be to generate the
>whole stream ahead of time (with timings info as to _when_ commands
>are entered), or to log it (again with timestamps) as it is generated.
>Then a hardware, software, or "thousand monkeys" (software test group
>of "naive users") method can be used at will, and re-play for regression
>testing would be a snap.

Sorry, Mike, but I agree with the original poster (Jim Adccock), and NOT
because I happen to work for the same company (different division, though).
Having a set of pre-defined commands with timing is necessary, and allows
you to test most corner cases, but random command/parameter combinations DO
catch a lot of "Gee, I never would have tried THAT" type bugs.  And sending
those commands at random time intervals, especially things like Device Clear
over IEEE-488 (GP-IB), is a good way to catch races and unprotected critical
code sections.  Using a fixed starting random number seed make the test
repeatable.

Art Boyne, boyne at hplvla.hp.com



More information about the Comp.lang.c mailing list