VB6 Random始终是相同的序列 [英] VB6 Random always the same sequence

查看:82
本文介绍了VB6 Random始终是相同的序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序内置了一个随机函数。它完美地运作。只有一个问题,它每次启动应用程序时都会运行完全随机的路径。因此,随机选择每次都会踢出相同的序列。还有什么我可以添加到代码中来克服这个问题吗?希望它有意义。


(代码)

Dim Q

Q = Int((68 * Rnd)+ 1)

Text5.Text = Q


谢谢

解决方案


我的应用程序内置了一个随机函数。它完美地运作。只有一个问题,它每次启动应用程序时都会运行完全随机的路径。因此,随机选择每次都会踢出相同的序列。还有什么我可以添加到代码中来克服这个问题吗?希望它有意义。


(代码)

Dim Q

Q = Int((68 * Rnd)+ 1)

Text5.Text = Q


谢谢



使用一个计时器控件和插入到20或者50


然后使用下面的代码

展开 | 选择 | Wrap | 行号


谢谢,


我会试一试,会让你知道


干杯


或你可以在表单中加载以下内容

展开 | 选择 | Wrap | 行号

I have a random function built into my application. It works perfectly. Just one problem it runs the exact random path every time you start the application. Therefore the random selection kicks out the same sequence every time. Is there anything else I can add to the code to overcome that problem? Hope it makes sense.

(Code)
Dim Q
Q = Int((68 * Rnd) + 1)
Text5.Text = Q

Thanks

解决方案

I have a random function built into my application. It works perfectly. Just one problem it runs the exact random path every time you start the application. Therefore the random selection kicks out the same sequence every time. Is there anything else I can add to the code to overcome that problem? Hope it makes sense.

(Code)
Dim Q
Q = Int((68 * Rnd) + 1)
Text5.Text = Q

Thanks

Use one timer control and intrvel to 20 or 50

then use the below code

Expand|Select|Wrap|Line Numbers


Thanks,

I will give it a go and will let you know

Cheers


or you could just place the following in your form load

Expand|Select|Wrap|Line Numbers


这篇关于VB6 Random始终是相同的序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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