OUTPUT_UNSET ();
output_close (&make_sync);
+ if (shuffle_mode)
+ DB (DB_BASIC, (_("Enabled shuffle mode: %s\n"), shuffle_mode));
+
if (read_files)
{
/* Update any makefiles if necessary. */
/* Simple random number generator, for use with shuffle.
This doesn't need to be truly random, just pretty random. Use our own
implementation rather than relying on the C runtime's rand() so we always
- get the same results for a given seed, regardless of OS. */
+ get the same results for a given seed, regardless of C runtime. */
static unsigned int mk_state = 0;
void
-make_seed(unsigned int seed)
+make_seed (unsigned int seed)
{
mk_state = seed;
}
unsigned int
-make_rand()
+make_rand ()
{
/* mk_state must never be 0. */
- if (mk_state == 0) {
+ if (mk_state == 0)
mk_state = (unsigned int)(time (NULL) ^ make_pid ()) + 1;
- }
/* A simple xorshift RNG. */
mk_state ^= mk_state << 13;
}
else
{
- if (strcasecmp (cmdarg, "random") != 0)
+ if (strcasecmp (cmdarg, "random") == 0)
+ config.seed = make_rand ();
+ else
{
/* Assume explicit seed. */
const char *err;