I would like to generate a random number based on this set, firstly how do I generate the numbers that belong to the Z* order q set. I have the q value and the prime p value.

Also if there's a library in python that does that already that'd be nice

  • $\begingroup$ docs.python.org/3/library/os.html , also don't forget to discard if the number is greater than $q$ otherwise there will be a bias. $\endgroup$ – kelalaka Jun 14 at 12:19
  • $\begingroup$ @kelalaka Are you sure you linked the correct page? os isn't a package for generating random numbers having the OP's requirements. $\endgroup$ – kiamlaluno Jun 15 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.