Generating Random Time

reubs

New member
Joined
Jan 29, 2008
Messages
1
Programming Experience
Beginner
Hi,
I am very new to VB and i'm trying to create an application for my students about timetables and want to randomly generate timetables and ask them questions about them.

Is there any code to generate a random time in 24hr (I.e. 23:34)

Thanks In Advance

Reubs

p.s I'm not sure if this is in the right place...
 
Like this?
VB.NET:
Private r As New Random
Private Function RandomTimeString() As String
    Return String.Format("{0}:{1}", r.Next(0, 24).ToString("00"), r.Next(0, 60).ToString("00"))
End Function
 
Back
Top