# Mu - 067random.cc

     1 :(before "End Primitive Recipe Declarations")
     2 REAL_RANDOM,
     3 :(before "End Primitive Recipe Numbers")
     4 put(Recipe_ordinal, "real-random", REAL_RANDOM);
     5 :(before "End Primitive Recipe Checks")
     6 case REAL_RANDOM: {
     7   break;
     8 }
     9 :(before "End Primitive Recipe Implementations")
    10 case REAL_RANDOM: {
    11   // todo: limited range of numbers, might be imperfectly random
    12   // todo: thread state in extra ingredients and products
    13   products.resize(1);
    14   products.at(0).push_back(rand());
    15   break;
    16 }
    17
    18 :(before "End Primitive Recipe Declarations")
    19 MAKE_RANDOM_NONDETERMINISTIC,
    20 :(before "End Primitive Recipe Numbers")
    21 put(Recipe_ordinal, "make-random-nondeterministic", MAKE_RANDOM_NONDETERMINISTIC);
    22 :(before "End Primitive Recipe Checks")
    23 case MAKE_RANDOM_NONDETERMINISTIC: {
    24   break;
    25 }
    26 :(before "End Primitive Recipe Implementations")
    27 case MAKE_RANDOM_NONDETERMINISTIC: {
    28   srand(time(NULL));
    29   break;
    30 }
    31
    32 // undo non-determinism in later tests
    33 :(before "End Reset")
    34 srand(0);