lumiera_/wiki
Ichthyostega 92bc044e9e Library: consider how to handle randomness in tests
Using random or pseudo-random numbers as input for tests
can be a very effective tool to spot unintended behaviour in
corner cases, and also helps writing more principled test verifications.
However, investigating failures in randomised tests can be challenging.

A well-proven solution is to exploit the **determinism** of pseudo-random-numbers
by documenting a randomly generated seed, that can be re-injected for investigation.

Up to now, most tests rely on the old library function `rand()`, while
at some places already the C++ standard framework for random number generation
is used, packaged into a custom wrapper. Adding adequate support for
documented seed values seems to be easy to achieve, after switching
existing usages of `rand()` to a suitable drop-in replacement.

After some consideration, I decided ''against'' wiring random generator instances
explicitly, while allowing to do so on occasion, when necessary. Thus
the planned seeding mechanism will rather re-seed a ''implicit default''
generator, which could then be used to construct explicit generator instances
when required (e.g. for multithreaded tests)

As a starting point, this changeset replaces the `randomise()` API call
by a direct access to the ''reseeding functionality'' exposed by the
C++ framework and all default generators. Since we already provide a
dedicated static instance of the plattform entropy source, re-randomisation
can be achieved by seeding from there.

NOTE: there was extended debate in the net, questioning the viability
of the `std::random_seq` -- these arguments, while valid from a theoretical
point of view, seem rather moot when placed into a practical context,
where even 2^32 different generation-paths(cycles) are more than enough
to provide sufficient diffusion of results (unless the goal is really to
engage into Monte-Carlo simulations for scientific research or large model
simulations).

Notable most of the more catchy reprovals raised by Melissa O'Neill
have been refuted by experts of the field, even while being still propagated
at various places in the net, often combined with promoting PCG-Random.
2024-11-10 03:25:45 +01:00
..
draw Job-Planning: new draft - organise the overall planning process 2023-04-17 04:51:38 +02:00
DIR_INFO update some DIR_INFO entries 2011-04-05 00:44:30 +02:00
dump Scheduler-test: complete and document the Load-peak tests 2024-04-12 02:23:31 +02:00
empty.html TiddlyWiki: bugfix for Firefox Quantum -- use HTML5 web storage instead of a Cookie 2018-10-20 02:07:10 +02:00
InterfaceConcept_Varga.mm Lumiera GUI thoughts -- Mindmap to complement the Interface concept PDF 2015-04-26 23:22:42 +02:00
renderengine.html Invocation: Analysis regarding node and turnout identity 2024-11-01 03:51:53 +01:00
thinkPad.ichthyo.mm Library: consider how to handle randomness in tests 2024-11-10 03:25:45 +01:00
uml better use doc/devel/uml... 2007-06-21 02:57:49 +02:00
workflow.mm DOC: expand concept map 2014-10-25 01:56:44 +02:00