Make randomSwitch use Double instead of Int, close #1495