Developer Reference


Example of Using Pseudorandom Number Generation Functions

Find Pseudorandom Co-primes
void FindCoPrimes(void){ int size;   // define Pseudo Random Generator (default settings) ippsPRNGGetSize(&size); IppsPRNGState* pPrng = (IppsPRNGState*)(new Ipp8u [size] ); ippsPRNGInit(160, pPrng);   // define 256-bits Big Numbers X and Y const int bnBitSize = 256; IppsBigNumState* bnX = New_BN(bnBitSize/32); IppsBigNumState* bnY = New_BN(bnBitSize/32);   // define temporary Big Numbers GCD and 1 IppsBigNumState* bnGCD = New_BN(bnBitSize/32); Ipp32u one = 1; IppsBigNumState* bnOne = New_BN(1, &one);     // generate pseudo random X and Y // while GCD(X,Y) != 1 Ipp32u result; int counter; for(counter=0,result=1; result; counter++) { ippsPRNGen_BN(bnX, bnBitSize, pPrng); ippsPRNGen_BN(bnY, bnBitSize, pPrng); ippsGcd_BN(bnX, bnY, bnGCD); ippsCmp_BN(bnGCD, bnOne, &result); }   cout <<"Coprimes:" <<endl; Type_BN("X: ", bnX); cout <<endl; Type_BN("Y: ", bnY); cout <<endl; cout <<"were fond on " <<counter <<" attempt" <<endl;   delete [] (Ipp8u*)pPrng; delete [] (Ipp8u*)bnX; delete [] (Ipp8u*)bnY; delete [] (Ipp8u*)bnGCD; delete [] (Ipp8u*)bnOne; }

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804