⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c写的序列生成程序.cpp

📁 最高效的随机序列生成代码!
💻 CPP
字号:
#include <stdio.h> // Developed by George Marsaglia, 1999
#include <math.h>
#include <stdlib.h>

#define znew1 (z1=36969*(z1&65535)+(z1>>16))
#define wnew1 (w1=18000*(w1&65535)+(w1>>16))
#define MWC1 ((znew1<<16)+wnew1 )
#define SHR31 (jsr1^=(jsr1<<17), jsr1^=(jsr1>>13), jsr1^=(jsr1<<5))
#define CONG1 (jcong1=69069*jcong1+1234567)
//#define FIB1 ((b1=a1+b1),(a1=b1-a1))
#define KISS1 ((MWC1^CONG1)+SHR31)
#define LFIB41 (c1++,t1[c1]=t1[c1]+t1[UC1(c1+58)]+t1[UC1(c1+119)]+t1[UC1(c1+178)])
#define SWB1 (c1++,bro1=(x1<y2),t1[c1]=(x1=t1[UC1(c1+34)])-(y2=t1[UC1(c1+19)]+bro1))
#define UNI1 (KISS1*2.328306e-10)
#define VNI1 ((long) KISS1)*4.656613e1-10
#define UC1 (unsigned char) /*a cast operation*/
typedef unsigned long UL1;

/* Global static variables: */
static UL1 z1=362436069, w1=521288629, jsr1=123456789, jcong1=380116160;
static UL1 a1=224466889, b1=7584631, t1[256];
const double e1=2.718282,pi1=3.1415926;
FILE *stream;
/* Use random seeds to reset z,w,jsr,jcong,a,b, and the table t[256]*/
static UL1 x1=0,y2=0,bro1; static unsigned char c=0;

/* Example procedure to set the table, using KISS: */
void settable1(UL1 i1,UL1 i2,UL1 i3,UL1 i4,UL1 i5, UL1 i6)
{
	int i; z1=i1;w1=i2,jsr1=i3; jcong1=i4; a1=i5; b1=i6;
	for(i=0;i<256;i=i+1) t1[i]=KISS1; 
}
double main()
{
	
	return UNI1;
}

⌨️ 快捷键说明

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