Блог пользователя AMR-KELEG

Автор AMR-KELEG, история, 7 лет назад, По-английски

Hi all,

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

Thanks

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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.