VB.NET随机/ C ++ rnd [英] VB.NET Random / C++ rnd

查看:101
本文介绍了VB.NET随机/ C ++ rnd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在尝试通过VB.NET和C ++中的种子创建一个随机数,2

不同的应用程序。我希望能够使用相同的种子并得到

相同的随机数,但遗憾的是VB.NET的Random类产生的结果不同于
不同于C ++ rnd函数。


我看不到任何通过API声明使用的rnd的参考,只是

试图找到一种生成方法通过种子的随机数,两种语言都是相同的
。当然我可以为我创建一个C ++ DLL

并在VB应用程序中使用它,但我宁愿不去那个极端1

方法。


任何建议都将不胜感激!


尼克。

解决方案
"尼克" < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


你好,


我正试图通过VB.NET和C ++中的种子创建一个随机数,2

不同的应用程序。我希望能够使用相同的种子并获得相同的随机数

但遗憾的是VB.NET的Random类产生的结果不同于
C ++ rnd函数。


我看不到任何关于通过API声明使用的rnd的引用和

只是想找到一种方法来生成一个通过种子的随机数,两种语言都是相同的
。当然我可以为我创建一个C ++ DLL

并在VB应用程序中使用它,但我宁愿不去那个极端的

1方法。


任何建议都将不胜感激!


尼克。



如果您使用的是托管C ++(C ++ / CLI),则可以在
VB.Net和C ++中使用Random类。


迈克。


很高兴有一套不同的结果:


如果不是为什么会被称为随机?


Michael D. Ober < obermd。@。alum.mit.edu.nospam.wrote in message

news:Ja ********************** ********@earthlink.co m ...


" Nick" < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


>你好,

我正在尝试通过VB.NET和C ++中的种子创建一个随机数,2
不同的应用。我希望能够使用相同的种子并获得相同的随机数,但遗憾的是VB.NET的Random类产生的结果与C ++ rnd函数不同。

我看不到任何关于通过API声明使用的rnd的参考,而只是试图找到一种通过两种语言相同的种子生成随机数的方法。当然我可以创建一个C ++ DLL来为我做这个并在VB应用程序中使用它,但我宁愿不去那个极端的方法。

任何建议都将不胜感激!

尼克。



如果您使用的是托管C ++(C ++ / CLI),则可以使用VB.Net和C ++中的随机类




迈克。


嗨Mike,


不幸的是,它是C ++ / WTL,没有托管代码

否则我首先不会遇到这个问题。


尼克。


" Michael D. Ober" < obermd。@。alum.mit.edu.nospam.wrote in message

news:Ja ********************** ********@earthlink.co m ...


" Nick" < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


>你好,

我正在尝试通过VB.NET和C ++中的种子创建一个随机数,2
不同的应用。我希望能够使用相同的种子并获得相同的随机数,但遗憾的是VB.NET的Random类产生的结果与C ++ rnd函数不同。

我看不到任何关于通过API声明使用的rnd的参考,而只是试图找到一种通过两种语言相同的种子生成随机数的方法。当然我可以创建一个C ++ DLL来为我做这个并在VB应用程序中使用它,但我宁愿不去那个极端的方法。

任何建议都将不胜感激!

尼克。



如果您使用的是托管C ++(C ++ / CLI),则可以使用VB.Net和C ++中的随机类




迈克。



Hi there,

I''m trying to create a random number via a seed in VB.NET and C++, 2
different applications. I want to be able to use the same seed and get the
same random number but unfortunately VB.NET''s Random class produces a
different set of results than the C++ rnd function.

I can''t see any reference of rnd being used via API declarations and am just
trying to find a way of generating a random number via seed that is
identical in both languages. Of course I could create a C++ DLL to do it
for me and use it in the VB app, but i''d rather not go to that extreme for 1
method.

Any suggestions would be greatly appreciated!

Nick.

解决方案

"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

Hi there,

I''m trying to create a random number via a seed in VB.NET and C++, 2
different applications. I want to be able to use the same seed and get
the same random number but unfortunately VB.NET''s Random class produces a
different set of results than the C++ rnd function.

I can''t see any reference of rnd being used via API declarations and am
just trying to find a way of generating a random number via seed that is
identical in both languages. Of course I could create a C++ DLL to do it
for me and use it in the VB app, but i''d rather not go to that extreme for
1 method.

Any suggestions would be greatly appreciated!

Nick.

If you are using managed C++ (C++/CLI), you can use the Random class in both
VB.Net and C++.

Mike.


be happy to have a different set of result :

if not why would it be called random ?

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam.wrote in message
news:Ja******************************@earthlink.co m...

"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

>Hi there,

I''m trying to create a random number via a seed in VB.NET and C++, 2
different applications. I want to be able to use the same seed and get
the same random number but unfortunately VB.NET''s Random class produces a
different set of results than the C++ rnd function.

I can''t see any reference of rnd being used via API declarations and am
just trying to find a way of generating a random number via seed that is
identical in both languages. Of course I could create a C++ DLL to do it
for me and use it in the VB app, but i''d rather not go to that extreme
for 1 method.

Any suggestions would be greatly appreciated!

Nick.

If you are using managed C++ (C++/CLI), you can use the Random class in
both VB.Net and C++.

Mike.


Hi Mike,

It''s not unfortunately, it''s C++ / WTL, no managed code in sight
otherwise I wouldn''t have this issue in the first place.

Nick.

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam.wrote in message
news:Ja******************************@earthlink.co m...

"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

>Hi there,

I''m trying to create a random number via a seed in VB.NET and C++, 2
different applications. I want to be able to use the same seed and get
the same random number but unfortunately VB.NET''s Random class produces a
different set of results than the C++ rnd function.

I can''t see any reference of rnd being used via API declarations and am
just trying to find a way of generating a random number via seed that is
identical in both languages. Of course I could create a C++ DLL to do it
for me and use it in the VB app, but i''d rather not go to that extreme
for 1 method.

Any suggestions would be greatly appreciated!

Nick.

If you are using managed C++ (C++/CLI), you can use the Random class in
both VB.Net and C++.

Mike.



这篇关于VB.NET随机/ C ++ rnd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆