fix lua math.random bug. expose RestoreState to lua script