tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Estimated hours taken: 1.5
Branches: main
library/random.m:
Provide better documentation on how (not) to use the random number
generator in the standard library. Generators of this kind are
very sensitive to the way in which they are used, and if used
in a way not anticipated they can give very poor results.
XXX The standard library really should provide a better quality RNG.
There is still a place for quick and dirty RNGs like this one,
though, provided users are given adequate information about the
pitfalls.
One of the pitfalls to avoid is that you shouldn't use mod (or rem)
to reduce a number down to some desired range, you should use
something like div. We therefore provide a predicate that does
this the prescribed way. We also provide a predicate that is
similar to randmax, but returns the number of distinct random
numbers that can be generated instead of the maximum.
Fix random__permutation to avoid the above pitfall.
Replace some occurrences of is/2 with =/2.
NEWS:
Mention the new predicate.
tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.exp:
tests/hard_coded/random_permutation.m:
A test case for random__permutation. We don't test that the
result is "random", but we at least test that it is a permutation.
tests/hard_coded/random_simple.exp:
tests/hard_coded/random_simple.m:
A simple test that checks for off-by-one errors in random__random/5.
tests/hard_coded/stable_sort.m:
tests/hard_coded/test_bitset.exp:
tests/hard_coded/test_bitset.m:
Fix these tests to avoid the above pitfall. The bitset tester also
needed to be modified so that it doesn't output anything that may
depend on the particular random sequence generated.