Results 1 to 2 of 2

Thread: Random Timer?

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    2

    Random Timer?

    I'm attempting to update our database at random intervals but for some reason I can't figure out why RndNo.Next(5000, 60000) doesn't seem to be Random at all for each time the callback is performed. I think that value gets set once and the Threading.Timer uses the value obtained from the first RndNo.Next(5000, 60000).

    Private m_thread As Threading.Timer
    Private RndSd As Random = New Random
    Private RndNo As Random = New Random(RndSd.Next())

    Sub Main()
    m_thread = New Threading.Timer(New Threading.TimerCallback AddressOf UpdateDatabase), Nothing, 0, RndNo.Next(5000, 60000))
    End Sub

    Public Sub UpdateDatabase()
    'update the database
    End Sub

    Does anyone have a clue how to make the call to UpdateDatabase truly random event firing someitme between 5 and 60 seconds?
    Last edited by evanescence; Jun 17th, 2003 at 03:01 PM.

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