随机获取问题 [英] Fetch Questions Randomly

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

问题描述

先生我做了一个在线测验项目。



问题编号是主键。



先生/女士

在测验中有一套30个问题。

我安排了15人的测验。





先生/女士

当我组织测验时,所有参与者都以相同的顺序或相同的序列号提出问题。 />
我想为所有参与者提取不同的问题(随机问题)。

我该怎么做。



请帮我解决这个问题。

解决方案

随机选择问题ID ...使用randon no代表1-30 ...



ie ...



随机rand =  new  Random(); 
int ra = rand.Next( 1 30 );





并使用此ra ....这是一种简单的方法...... / blockquote>

HI,



结帐以下2个解决方案:



1:

 公开  Form1 

< span class =code-keyword>私有 Sub Button1_Click( ByVal sender 作为系统。对象 ByVal e As System.EventArgs)句柄 Button1.Click

' 在VB.NET中创建一个新的Random类
Dim RandomClass As New Random()

Dim RandomNumber As 整数
生成1到2,147,483,647之间的随机数
RandomNumber = RandomClass。下一步()
MessageBox.Show(RandomNumber, www.interloper.nl,MessageBoxButtons.OK,MessageBoxIcon.Information)


Dim RandomNumber2 正如 整数
' 生成100到200之间的随机数
RandomNumber2 = RandomClass。下一步 100 200
MessageBox.Show(RandomNumber2, www.interloper.nl,MessageBoxButtons.OK,MessageBoxIcon.Information)

结束 Sub

结束 班级





2.

公开函数GetRandomNum 
将myRandom调暗为新的随机
dim RandomNumber as Integer = myRandom.Next(''first value,''sencond value)''作为整数
返回RandomNumber
结束功能





谢谢


Hello Ankur,



Random是.net中的预定义类,因此您可以使用Random类生成随机数。

Ex:



 Dim r As New Random 
For i As Integer = 0 30
Dim r As New Random
r.Next()
下一页





使用这30个数字来获取问题,因为 Random 类每次生成不同的值执行。



希望这会对你有所帮助。



与Prafulla欢呼


Sir i make an online quiz project.

The question number is a primary key.

Sir/Madam
In the Quiz there is a set of 30 Questions.
And i schedule the quiz for 15 persons.


Sir/Madam
when i organize the quiz then all the participants have the question in the same order or in the same serial number.
I want to fetch the questions differently(Random Question) for all the participants.
How can i do it.

Please help me regarding this.

解决方案

choose question id randomly ... use randon no for 1-30...

i.e....

Random rand = new Random();
        int ra = rand.Next(1, 30);



and use use this ra .... this is a easy way ....


HI,

checkout the following 2 solutions:

1:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Create a new Random class in VB.NET
        Dim RandomClass As New Random()

        Dim RandomNumber As Integer
        'Generate a random number between 1 and 2,147,483,647
        RandomNumber = RandomClass.Next()
        MessageBox.Show(RandomNumber, "www.interloper.nl", MessageBoxButtons.OK, MessageBoxIcon.Information)


        Dim RandomNumber2 As Integer
        'Generate a random number between 100 and 200
        RandomNumber2 = RandomClass.Next(100, 200)
        MessageBox.Show(RandomNumber2, "www.interloper.nl", MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub

End Class



2.

Public Function GetRandomNum
Dim myRandom as New Random
dim RandomNumber as Integer = myRandom.Next(''first value, ''sencond value) ''both as integers
Return RandomNumber
End Function



Thanks


Hello Ankur,

Random is a predefined class in .net so you can use Random class to generate random numbers.
Ex:

Dim r As New Random
For i As Integer = 0 To 30
            Dim r As New Random
            r.Next()
        Next



use this 30 numbers to fetch the questions because Random class generate different values each time it will execute.

Hope this helps you.

Cheers with Prafulla


这篇关于随机获取问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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