Handbook
Glossary
random-prime ( numbits -- p )
Prime numbers
Prev:
primes-between ( low high -- seq )
Next:
find-relative-prime ( n -- p )
Vocabulary
math
.
primes
Inputs
numbits
an
integer
Outputs
p
an
integer
Word description
Returns a prime number exactly
numbits
bits in length, with the topmost bit set to one.
Definition
USING:
kernel
math
random
;
IN:
math.primes
:
random-prime
( numbits -- p )
[
]
[
2^
]
[
random-bits-exact
next-prime
]
tri
2dup
<
[
2drop
random-prime
]
[
2nip
]
if
;