Reformat pick_random() in magics calculation