Creating a Custom Hypersecant distribution

Could it be because of the def random?