$rand write to file