r.randi is undefined, should be r.rand