fixed randomize switch, closes #39