import random # in observe, this ought to be cryptographically safeimport numpy as npfrom numpy.polynomial import…