AMR-KELEG's blog

By AMR-KELEG, history, 5 years ago, In English

Hi all,

Can you tell me how can i generate Random Prime Numbers in polygon using generators?


  • Vote: I like it
  • 0
  • Vote: I do not like it

5 years ago, # |
  Vote: I like it +5 Vote: I do not like it

If you need a prime number from a huge interval, the following method is good enough (it doesn't guarantee the uniform distribution, though). Choose a random number from the given interval and increment it by 1 till you get a prime number. You need a function that checks if some huge number is prime — search "primality test" in google.