⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changshengrandom.cs

📁 一个简单的考生答题系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Myschool
{
    /// <summary>
    /// 产生随机数的类
    /// </summary>
    class ChangshengRandom
    {
       
        public static void SetselectedQuestionIds(string subject) {
            int i = 0,a=0;//i记录抽取了几道题
            int j = Myschool.Select.getCount(subject);
            Random random = new Random();
            int [] queid=new int[j];
            bool [] state=new bool[j];
            Myschool.Select.getqueId(subject,ref queid,ref state);
            int questionIdex = 0;//随机产生的问题的索引值
            //抽取每一道题并保存抽出题目的ID
            while (i<20) {//当产生20个和问题编号相同的随机数时就停止循环
                questionIdex = random.Next(queid.Length);
                if (state[a] == false) {
                    QueHelp.allQuestionid[a] = queid[a];
                    state[a] = true;
                    i++;

                }
                a++;
            }
           
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -