stdafx.cpp

来自「预测神经网络」· C++ 代码 · 共 63 行

CPP
63
字号
// stdafx.cpp : source file that includes just the standard includes
//	probp.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

float bedlam(long idum)
{
	int xj;
	long xk;
	static long iy=0;
	static long iv[NTAB];
	float temp;
	
	if(idum <= 0 || !iy)
	{
		if(-(idum) < 1)
		{
			idum = 1 + idum;
		}
		else
		{
			idum = -(idum);
		}
		for(xj = NTAB+7; xj >= 0; xj--)
		{
			xk = (idum) / IQ;
			idum = IA * (idum - xk * IQ) - IR * xk;
			if(idum < 0)
			{
				idum += IM;
			}
			if(xj < NTAB)
			{
				iv[xj] = idum;
			}
		}
		iy = iv[0];
	}
	
	xk = (idum) / IQ;
	idum = IA * (idum - xk * IQ) - IR * xk;
	if(idum < 0)
	{
		idum += IM;
	}
	xj = iy / NDIV;
	iy = iv[xj];
	iv[xj] = idum;
	
	if((temp=float(AM*iy)) > RNMX)
	{
		return(float)(RNMX);
	}
	else
	{
		return(temp);
	}
} 
// end of bedlam function


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?