Generate 32 bits random PRIME number

Hello, may I know how to generate 32-bit random prime number? Pls reply asap. thanks
Pick a random value, calculate if it is a prime number, if it isnt, add 1, and repeat until you get a prime number(or until you get to the highest 32 bit value, if thats the case, go back to your value, substract 1, calculate, and repeat until you get a prime number)

Or write all prime numbers into an array, and pick a random one
Last edited on
thanks, but how to calculate if it is a prime number?
Topic archived. No new replies allowed.