>>>>> "Slava" == Slava Pestov <[email protected]> writes:
Slava> This unit test from math.primes fails sometimes: [...] Slava> I assume the bug is in random-prime, which is called by Slava> unique-primes. [...] Slava> So if random-bits returns a number greater than 32749, then Slava> next-prime will return 32771 (> 32767) which has 16 bits, not 15 Slava> as required. A similar situation can occur with any number of Slava> bits. Slava> I believe the correct fix would be for random-prime to call Slava> itself again if the result of next-prime is too big, but I'm not Slava> sure. How important is it that the result has <= n bits? Also Slava> would my suggestion above skew the distribution somehow? I don't know how important that is (according to "git blame", Doug wrote this), but since it used by the rsa implementation, better be safe than sorry. The fix you suggested is available in git://git.rfc1149.net/factor.git for-slava This should not skew the distribution at all, since unfitting numbers are discarded; if they were wrapped around this would be another story. Sam -- Samuel Tardieu -- [email protected] -- http://www.rfc1149.net/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
