ran4.c
来自「这个代码是policy iteration算法关于强化学习的. 请您用winzi」· C语言 代码 · 共 27 行
C
27 行
float ran4(long *idum){ void psdes(unsigned long *lword, unsigned long *irword); unsigned long irword,itemp,lword; static long idums = 0;#if defined(vax) || defined(_vax_) || defined(__vax__) || defined(VAX) static unsigned long jflone = 0x00004080; static unsigned long jflmsk = 0xffff007f;#else static unsigned long jflone = 0x3f800000; static unsigned long jflmsk = 0x007fffff;#endif if (*idum < 0) { idums = -(*idum); *idum=1; } irword=(*idum); lword=idums; psdes(&lword,&irword); itemp=jflone | (jflmsk & irword); ++(*idum); return (*(float *)&itemp)-(float)1.0;}
/* (C) Copr. 1986-92 Numerical Recipes Software 'j''25E#. */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?