Hi,

I'm working a small maths program for students.

A question like this comes up:

"A group of 40 students were given 4 projects each to complete. The results are shown on the table below."

The number of students can range from 24 to 55, at random, when the button is clicked.
The number of projects can range from 4 to 6, at random, when the button is clicked.

Then the number of students is divided into 4 random numbered groups.

For example, let's say the number of students is 42. Then the groups could be: 4, 10, 0, 28...or....16,10,9, 7...etc.

But it's not working! My numbers aren't random! Every time I load my form, and click the command button, the numbers come up in same order. Could someone please look at my code and tell me what's wrong? I heard VB doesn't generate truly random numbers, but it's a bit far when it comes up the same every single time.

-------
'Required: command button, picturebox and label

Dim rstudents As Integer
Dim rprojects As Integer
Dim rfirst As Integer
Dim rsecond As Integer
Dim rresult As Integer
Dim rthird As Integer

Private Sub CmdRandom_Click()

rstudents = 24 + Int(32 * Rnd())
rprojects = 4 + Int(3 * Rnd())
Label1.Caption = "A group of " & rstudents & " students were given " & _
rprojects & " projects each to complete. The results are shown on the" & _
" table below."

rfirst = (Rnd * (rstudents))
rsecond = (Rnd * (rstudents - rfirst))
rresult = rstudents - rfirst - rsecond
rthird = (Rnd * (rresult))
rresult2 = rstudents - rfirst - rsecond - rthird
Picture1.Print rfirst & vbNewLine & rsecond & vbNewLine & rthird & vbNewLine & rresult2
End Sub