本文介绍了msvcrt.dll对其rand()函数使用线性同余发生器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图预测使用msvcrt的rand()函数生成三个骰子的脸的程序的输出。我相信代码是这样的:
dice [0] = rand()%6 + 1; dice [1] = rand()%6 + 1; dice [2] = rand()%6 + 1; ,我想知道我是否可以使用线性同余发生器的预测程序来预测序列中的下一个数字。

I am trying to predict the output of a program that uses msvcrt's rand() function for generating the face of three dice. I believe the code is something like:dice[0] = rand() % 6 + 1; dice[1] = rand() % 6 + 1; dice[2] = rand() % 6 + 1;, and I was wondering if I could use a prediction program for linear congruential generators to predict the next numbers in the sequence.

推荐答案

查看自己: C:\Program Files \Microsoft Visual Studio 8 \VC \crt\ src\rand.c

(或使用%VCINSTALLDIR%\crt\src\rand。

(Or use %VCINSTALLDIR%\crt\src\rand.c if you're running from a VC command prompt.)

(假设您至少拥有 标准版本 > of VC。这是两行,我会发布,但不知道许可证是否允许。)

(Assuming you have at least the standard version of VC. It's two lines. I'd post it, but not sure whether the license allows it.)

这篇关于msvcrt.dll对其rand()函数使用线性同余发生器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 08:51