.. _primetest:

PrimeTest
=========


Tests the given integer for being a probable prime.


Syntax
------


IppStatus ippsPrimeTest(int nTrials, Ipp32u \*pResult, IppsPrimeState\*
pCtx, IppBitSupplier rndFunc, void\* pRndParam);


Include Files
-------------


``ippcp.h``

Parameters
----------


.. list-table:: 
   :header-rows: 0

   * -     nTrials   
     -  Security parameter specified for the Miller-Rabin probable primality.
   * -     pResult   
     -  Pointer to the result of the primality test.
   * -     pCtx    
     -  Pointer to the IppsPrimeState context.
   * -     rndFunc   
     -  Specified Random Generator.
   * -     pRndParam   
     -  Pointer to the Random Generator context.




Description
-----------


The function uses the Miller-Rabin probabilistic primality test scheme
with the given security parameter to test if the given integer is a
probable prime. The pseudorandom number used in the Miller-Rabin test is
generated by the specified rndFunc Random Generator. The function sets
up the \*pResult as IS_PRIME or IS_COMPOSITE to show if the input
probable prime passes the Miller-Rabin test.


Return Values
-------------


.. list-table:: 
   :header-rows: 0

   * -     ippStsNoErr   
     -  Indicates no error. Any other value indicates an error or warning.
   * -     ippStsNullPtrErr   
     -  Indicates an error condition if any of the specified pointers is NULL.
   * -     ippStsContextMatchErr   
     -  Indicates an error condition if the context parameter does not match the operation.
   * -     ippStsBadArgErr   
     -  Indicates an error condition if nTrials is less than 1.



