Index: llvm/trunk/tools/llvm-stress/llvm-stress.cpp =================================================================== --- llvm/trunk/tools/llvm-stress/llvm-stress.cpp +++ llvm/trunk/tools/llvm-stress/llvm-stress.cpp @@ -116,10 +116,14 @@ /// Make this like a C++11 random device typedef uint32_t result_type; - uint32_t operator()() { return Rand32(); } static constexpr result_type min() { return 0; } static constexpr result_type max() { return 0x7ffff; } - + uint32_t operator()() { + uint32_t Val = Rand(); + assert(Val <= max() && "Random value out of range"); + return Val; + } + private: unsigned Seed; };