diff --git a/threadlab/Makefile b/threadlab/Makefile new file mode 100644 index 0000000..5fec976 --- /dev/null +++ b/threadlab/Makefile @@ -0,0 +1,2 @@ +all: SearchRandom.c + gcc -o SearchRandom SearchRandom.c diff --git a/threadlab/SearchRandom b/threadlab/SearchRandom new file mode 100755 index 0000000..349dc08 Binary files /dev/null and b/threadlab/SearchRandom differ diff --git a/threadlab/SearchRandom.c b/threadlab/SearchRandom.c new file mode 100644 index 0000000..5b799f4 --- /dev/null +++ b/threadlab/SearchRandom.c @@ -0,0 +1,65 @@ +/* + 某个应用程序的随机数产生机制是这样的: + 1、首先产生一个0~0xFFFFFFFF之间的数,称为“密码”X + 2、用(X,0x29A)调用随机数更新函数GenerateRandomNumber,产生新的(Y,Z) + 3、用(Y,Z)调用随机数更新函数GenerateRandomNumber,产生新的(A,B) + 4、把B传给用户 + + 本程序(你的)目的,就是在知道这套机制、知道B的前提下,计算出X是多少? + + 非常简单的思路: + 1、循环,从i=0~0xFFFFFFFF + 2、GenerateRandomNumber(i,0x29A) + 3、GenerateRandomNumber(A,B) + 4、判断B是否等于想要找的值 + +*/ + +#include +#include + +/* 更新随机数 */ +void GenerateRandomNumber(unsigned int *rand1_h,unsigned int *rand1_l) +{ + /*请忽略下列代码,知道是产生更新随机数即可,原理不必弄清楚*/ + unsigned long long x = (unsigned long long)*rand1_h; + x *= 0x6AC690C5; + x += *rand1_l; + + *rand1_h = (unsigned int)x; + *rand1_l = (unsigned int)(x>>32); +} + +void SearchRandomNumber(unsigned int begin_h,unsigned int begin_l, unsigned int search_val) +{ + /* 在begin_l~begin_h之间,计算B的值,看看是否和search_val相等*/ + unsigned int i; + unsigned int h,l; + + for (i=begin_l;i 0x70FFFFFF + end_time = time(NULL); // 记录结束时刻 + + printf("耗时%ld秒~~\n",end_time-begin_time); // 结束-开始=耗时 + return 0; +} diff --git a/threadlab/计算机系统-实验11.pptx b/threadlab/计算机系统-实验11.pptx new file mode 100644 index 0000000..30d262c Binary files /dev/null and b/threadlab/计算机系统-实验11.pptx differ diff --git a/weblab/index.html b/weblab/index.html new file mode 100644 index 0000000..11f4d92 --- /dev/null +++ b/weblab/index.html @@ -0,0 +1,15 @@ + + + +ǧǵWeb + + +

ǰ~

+

ôˣ

+

ǰ޳

+

ѽij

+

˵ǰóһ糵

+

+

ӻǹ~~

+ + diff --git a/weblab/www.ini b/weblab/www.ini new file mode 100644 index 0000000..812b2fc --- /dev/null +++ b/weblab/www.ini @@ -0,0 +1,2 @@ +root=c:\adb +port=80 diff --git a/weblab/计算机系统-实验10.pptx b/weblab/计算机系统-实验10.pptx new file mode 100644 index 0000000..2296adf Binary files /dev/null and b/weblab/计算机系统-实验10.pptx differ