Only use unpromoted arithmetic for types no larger than 32 bit on 32 bit systems. Use explicit integer sizes in random test to avoid errors on 32 bit systems.

This one should fix the test errors for random.jl on 32 bit machines. The changes are those suggested by @rickhg12hs in #6577.