Used a local var.
Used torch.random() instead of math.random().
Merge pull request #26 from fidlej/topic_safer

Local var and torch.random()