Make the rand tests determinstic. (fixes #2714)

This avoids spurious errors with the old tests but still tests
 enough that if the rng is replaced with a totally broken one
 it should still fail.