update gem and random function