RandUniform

Generates the pseudo-random samples with a uniform distribution.

Syntax

IppStatus ippsRandUniform_8u(Ipp8u* pDst, int len, IppsRandUniState_8u* pRandUniState);

IppStatus ippsRandUniform_16s(Ipp16s* pDst, int len, IppsRandUniState_16s* pRandUniState);

IppStatus ippsRandUniform_32f(Ipp32f* pDst, int len, IppsRandUniState_32f* pRandUniState);

Parameters

pDst

Pointer to the array which stores the samples.

len

Number of samples to be computed.

pRandUniState

Pointer to the structure containing parameters for the generator of noise.

Description

The function ippsRandUniform is declared in the ipps.h file. This function generates len pseudo-random samples with a uniform distribution and stores them in the array pDst. Initial parameters of the generator are set in the generator state structure pRandUniState. Before calling ippsRandUniform, you must initialize the generator state by calling the function ippsRandUniformInitAlloc.

Example  below demonstrates how to use the function ippsRandUniform.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pDst or pRandUniState pointer is NULL.

ippStsContextMatchErr

Indicates an error when the state identifier is incorrect.

Using the Function to Generate Pseudo-Random Signal

void func_randuniform()
{
    IppsRandUniState_16s*
pRUS;
    Ipp16s low, high;
    low = -4096;
    high = 4095;
    unsigned int seed
= 0;
    Ipp16s* pDst;
    int len = 512;
    IppStatus status;

		
    status = ippsRandUniformInitAlloc_16s(&pRUS,low,high,seed);
    if(ippStsNoErr !=
status)
      printf("IPP Error: %s",ippGetStatusString(status));

		
    status = ippsRandUniform_16s(pDst,len,
pRUS);
    if(ippStsNoErr !=
status)
      printf("IPP Error: %s",ippGetStatusString(status));
}

		

		
result:




Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.