From b440bda681762dfca5f0eeea84121d62decb5a36 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 25 Apr 2008 00:25:37 -0500 Subject: [PATCH] error message --- extra/math/miller-rabin/miller-rabin.factor | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extra/math/miller-rabin/miller-rabin.factor b/extra/math/miller-rabin/miller-rabin.factor index 7835277b9b..a1f90d74c9 100755 --- a/extra/math/miller-rabin/miller-rabin.factor +++ b/extra/math/miller-rabin/miller-rabin.factor @@ -1,4 +1,4 @@ -USING: combinators combinators.lib io locals kernel math +eSING: combinators combinators.lib io locals kernel math math.functions math.ranges namespaces random sequences hashtables sets ; IN: math.miller-rabin @@ -76,7 +76,9 @@ TUPLE: miller-rabin-bounds ; : find-relative-prime ( n -- p ) dup random find-relative-prime* ; +ERROR: too-few-primes ; + : unique-primes ( numbits n -- seq ) #! generate two primes - over 5 < [ "not enough primes below 5 bits" throw ] when + over 5 < [ too-few-primes ] when [ [ drop random-prime ] with map ] [ all-unique? ] generate ;