Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


VB.net code...CPU time scheduler (shortest job first)


VB.net code...CPU time scheduler (shortest job first)

Author
Message
charliemears
charliemears
Forum God
Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)

Group: Forum Members
Posts: 4, Visits: 8


I really need VB.Net code for this...

How can I generate a random number?



I will use this code for my project on CPU time scheduling which is Shortest Job First(SJF)...

any idea about this? or any useful source where can I get this program or code?

or

you can share a code or a hint....



many many thanks for any reply....










capobythesea - residential drug treatment rehabilitation center in Dana Point California.
waynespangler
waynespangler
Forum God
Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)Forum God (97K reputation)

Group: Forum Members
Posts: 910, Visits: 5.4K

This is vb6 forum. Should be in net forum.

However here is random number between 0 and 100.

Dim rNum As New Random
Dim x As Integer = rNum.Next(0, 100)



Wayne

I know enough to be dangerious.

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.

cr4sh09
cr4sh09
Forum God
Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)Forum God (859 reputation)

Group: Forum Members
Posts: 5, Visits: 34
If you need nonrepeating random numbers, you could write your code like this:

Dim arrNum(1 To 100) As Integer       '1 Being the lowest random number, 100 being the highest
Dim intNum As Integer
Dim y As Integer
Dim z As Integer
  Start:
    Randomize()
    intNum = Int((99 * Rnd()) + 1)    'Number range 1-100
      For y = 1 To 100                'Number of different random numbers you need
        If intNum = arrNum(z) Then    'Checks the random number to the array for repeats
      GoTo Start                      'Repeats are ignored and a new random number is generated
    End If
      arrNum(x) = intNum              'Adds the random number to an array
    Next y
Exit Sub
End Sub
End
Class

 

But if you simply just want random numbers, you could write your code like this:

Dim Value As Object
  Randomize()
    Value = Int(100 * Rnd())     
'Gives a random number between 1 - 100

 

Hope this helps you.

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search