UNIX的Windows / Visual C / C ++ 6.0的nrand48()例程? [英] UNIX's nrand48() routine for Windows/Visual C/C++ 6.0 ?
问题描述
您好,
我有一小段C源代码可能是在UNIX
系统上制作的。
>
我想尝试使用Visual C / C ++ 6.0在Windows XP上编译/构建此源代码
。
问题在于nrand48()。看起来UNIX系统有这个例程
nrand48()in< stdlib.h>
看起来Visual C / C ++ 6.0没有这个例程在它的图书馆?
我不知道如何编程工作,所以我想将更改
降到最低。
所以问题变成:
对于Visual C / C ++ 6.0,nrand48()的最佳替代是什么?
再见,
Skybuck。
Hello,
I have a little piece of C source code which was probably made on a UNIX
system.
I would like to try and compile/build this source code on/for Windows XP
with Visual C/C++ 6.0.
The problem is with nrand48(). Apperently the UNIX system has this routine
nrand48() in <stdlib.h>
Apperently Visual C/C++ 6.0 doesn''t have this routine in it''s library ?
I have no further idea how to program works so I would like to keep changes
to a minimum.
So the question becomes:
What is the best replacement for nrand48() for Visual C/C++ 6.0 ?
Bye,
Skybuck.
推荐答案
Skybuck Flying< no **** @ hotmail.com> ;写道:
Skybuck Flying <no****@hotmail.com> wrote:
我有一小段C源代码可能是在UNIX
系统上制作的。
我想在/上编译/构建这个源代码适用于Windows XP
使用Visual C / C ++ 6.0。
问题在于nrand48()。看起来UNIX系统有这个例程
nrand48()在< stdlib.h>
看起来Visual C / C ++ 6.0在它的库中没有这个例程吗?
我没有进一步的想法如何编程工作所以我想将更改保持在最低限度。
所以问题变成:
对于Visual C / C ++,nrand48()的最佳替代品是什么? 6.0?
I have a little piece of C source code which was probably made on a UNIX
system.
I would like to try and compile/build this source code on/for Windows XP
with Visual C/C++ 6.0.
The problem is with nrand48(). Apperently the UNIX system has this routine
nrand48() in <stdlib.h>
Apperently Visual C/C++ 6.0 doesn''t have this routine in it''s library ?
I have no further idea how to program works so I would like to keep changes
to a minimum.
So the question becomes:
What is the best replacement for nrand48() for Visual C/C++ 6.0 ?
危险地接近偏离主题;-)如果您系统上的RAND_MAX是2147483647(2 ^ 31 - 1)
可以用标准C
函数rand()替换nrand48()而不做任何更改(除非
程序中使用的算法也依赖于nrand48的其他一些属性) ()函数,
见
http://www.opengroup.org/onlinepubs/...s/drand48.html
否则你必须留意返回的其他一些函数/>
在[0,2 ^ 31]区间内均匀分布的伪随机数,
我想MS编程组中的某个人会知道要使用什么。
问候,Jens
-
\ Jens Thoms Toerring ___ Je *********** @ physik.fu-berlin.de
\ __________________________ < a rel =nofollowhref =http://www.toerring.detarget =_ blank> http://www.toerring.de
Dangerously near to off-topic;-) If RAND_MAX is 2147483647 (2^31 - 1)
on your system you can probably replace nrand48() by the standard C
function rand() without any changes (unless the algorithms used in the
program rely also on some other properties of the nrand48() function,
see
http://www.opengroup.org/onlinepubs/...s/drand48.html
Otherwise you have to look out for some other function that returns
uniformely distributed pseudo-random numbers in the interval [0,2^31),
I guess someone in a MS-programming group will know what to use.
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
< Je *********** @ physik.fu-berlin.de>在消息中写道
新闻:2k ************ @ uni-berlin.de ...
<Je***********@physik.fu-berlin.de> wrote in message
news:2k************@uni-berlin.de...
Skybuck Flying< no ** **@hotmail.com>写道:
Skybuck Flying <no****@hotmail.com> wrote:
我有一小段C源代码可能是在UNIX
系统上制作的。
我想在/上编译/构建这个源代码适用于Windows XP
使用Visual C / C ++ 6.0。
问题在于nrand48()。显然,UNIX系统在< stdlib.h>中有这个
例程nrand48()。显然,Visual C / C ++ 6.0在它的库中没有这个例程吗?
我没有进一步的想法如何编程工作,所以我想保持
更改至少。
所以问题变成:
对于Visual C / C ++,nrand48()的最佳替代品是什么? 6.0?
非常接近偏离主题;-)如果你的系统上RAND_MAX是2147483647(2 ^ 31 - 1)
你可以用标准的C
函数rand替换nrand48() ()没有任何变化(除非
程序中使用的算法也依赖于nrand48()函数的其他一些属性,
http://www.opengroup.org/onlinepubs/...s/drand48.html
否则你必须留意一些其他函数返回
统一分布的伪随机数e interval [0,2 ^ 31],
我想MS编程组中的某个人会知道要使用什么。
I have a little piece of C source code which was probably made on a UNIX
system.
I would like to try and compile/build this source code on/for Windows XP
with Visual C/C++ 6.0.
The problem is with nrand48(). Apperently the UNIX system has this routine nrand48() in <stdlib.h>
Apperently Visual C/C++ 6.0 doesn''t have this routine in it''s library ?
I have no further idea how to program works so I would like to keep changes to a minimum.
So the question becomes:
What is the best replacement for nrand48() for Visual C/C++ 6.0 ?
Dangerously near to off-topic;-) If RAND_MAX is 2147483647 (2^31 - 1)
on your system you can probably replace nrand48() by the standard C
function rand() without any changes (unless the algorithms used in the
program rely also on some other properties of the nrand48() function,
see
http://www.opengroup.org/onlinepubs/...s/drand48.html
Otherwise you have to look out for some other function that returns
uniformely distributed pseudo-random numbers in the interval [0,2^31),
I guess someone in a MS-programming group will know what to use.
是的,我相信程序依赖于nrand48特殊属性...
问候,Jens
-
\ Jens Thoms Toerring ___ Je *********** @ physik.fu-berlin.de
\ __________________________ http://www.toerring.de
>
在文章< cc ********** @ news1.tilbu1.nb.home.nl>中,否**** @ hotmail.com 说...
In article <cc**********@news1.tilbu1.nb.home.nl>, no****@hotmail.com says...
对于Visual C / C ++ 6.0,nrand48()的最佳替换是什么?
What is the best replacement for nrand48() for Visual C/C++ 6.0 ?
几乎总是如此,对于符合标准的代码,请使用rand / srand,
或者如果您想要保证PRNG的质量,请使用已知的
便携式和足够的质量。 Mersenne Twister是一个很好的
起点。
-
Randy Howard
要回复,请删除FOOBAR。
As is almost always the case, for standards compliant code, use rand/srand,
or if you want a guarantee on the quality of a PRNG, use one known to be
both portable and of sufficient quality. "Mersenne Twister" is a good
place to start.
--
Randy Howard
To reply, remove FOOBAR.
这篇关于UNIX的Windows / Visual C / C ++ 6.0的nrand48()例程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!