From b7d7bb49054cfe82ed233c9da39ec4d9fb1d5d43 Mon Sep 17 00:00:00 2001 From: mschauer Date: Fri, 8 May 2015 12:19:44 +0200 Subject: [PATCH] doc for isprime(::BigInt) --- doc/stdlib/numbers.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/stdlib/numbers.rst b/doc/stdlib/numbers.rst index c1c67b80e998e..95eab48b63f56 100644 --- a/doc/stdlib/numbers.rst +++ b/doc/stdlib/numbers.rst @@ -362,6 +362,18 @@ Integers julia> isprime(3) true +.. function:: isprime(x::BigInt, [reps = 25]) -> Bool + + Probabilistic primality test. Returns ``true`` if ``x`` is prime; and + ``false`` if ``x`` is not prime with high probability. The false positive + rate is about ``0.25^reps``. ``reps = 25`` is considered safe for + cryptographic applications (Knuth, Seminumerical Algorithms). + + .. doctest:: + + julia> isprime(big(3)) + true + .. function:: primes(n) Returns a collection of the prime numbers <= ``n``. @@ -458,7 +470,7 @@ As ``BigInt`` represents unbounded integers, the interval must be specified (e.g ``S`` defaults to ``Float64``. -.. function:: rand!([rng], A ,[coll]) +.. function:: rand!([rng], A, [coll]) Populate the array A with random values. If the indexable collection ``coll`` is specified, the values are picked randomly from ``coll``. This is equivalent to ``copy!(A, rand(rng, coll, size(A)))`` or ``copy!(A, rand(rng, eltype(A), size(A)))`` but without allocating a new array.