CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    maharashtra,india
    Posts
    12

    random selection of data

    I am doing a project on online examination. I have entered data (questions) into the database. I would be thankful if someone could suggest the code for automatically random selection of data(questions) when a user appears for the test.

    Thanks.


  2. #2
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    Re: random selection of data

    This gives you a random number:

    private Sub Command1_Click()
    dim sngRandom as Single
    sngRandom = Rnd(1)
    MsgBox sngRandom
    End Sub



    Then you can manipulate it, let's say selecting 3rd and 5th digits, or multiplying returned number by 100 and getting last 3 or first 4 (whatever) digits. If you have limited number of questions (let's say 75), then in case you got the number greater than 75, subtruct somthing (can be random too, or static), or divide, or ....

    Vlad



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured