View Single Post
 
Old 11-30-2014, 09:16 AM
snarfblam's Avatar
snarfblam snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 896
Default

You would want to add a constructor to FleetOfCars that accepts a random seed, which you can use to create a new Random object. If a new random seed is not specified, you would want to continue to use the shared Random object rather than creating a new one so you get a unique random value.

Your example would then be modified like so:
Code:
Public Sub Main()
   For i = 0 to 10
      Dim MyFleetOfCars as FleetOfCars = New FleetOfCars(20, 1234)
      MyFleetOfCars.PrintCarsSpecs()
   Next 
End Sub
__________________
C# _VB.NET _
Reply With Quote