Fixed math.random, closes #400.