uran.c
来自「Practical DSP Applications in Communicat」· C语言 代码 · 共 14 行
C
14 行
/**************************************************************
* URAN - This function generates pseudo-random numbers *
**************************************************************/
static long n=(long)12357; // seed x(0) = 12357
float uran()
{
float ran; // random noise r(n)
n=(long)2045*n+1L; // x(n)=2045*x(n-1)+1
n-=(n/1048576L)*1048576L;//x(n)=x(n)-INT[x(n)/1048576]*1048576
ran=(float)(n+1L)/(float)1048577; //r(n)=FLOAT[x(n)+1]/1048577
return(ran); // return r(n) to main function
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?