ns2::IdRandomizer Class Reference


Detailed Description

class for randomizing ids a sumo id maps to a ns2 id. selecting the mapping is done by randomizing
Author:
Thimor Bohn <bohn@itm.uni-luebeck.de>

Definition at line 13 of file IdRandomizer.java.


Static Public Member Functions

static void randomize (List< String > wantedVehicle, List< String > vehicleNewId, long seed)

Member Function Documentation

static void ns2::IdRandomizer::randomize ( List< String >  wantedVehicle,
List< String >  vehicleNewId,
long  seed 
) [inline, static]

working method

Parameters:
wantedVehicle list of vehicles to be selected for ns2
vehicleNewId list of vehicle ids for ns2

Definition at line 19 of file IdRandomizer.java.

00019                                                                                                    {
00020         // set of new ids = {0, 1, ..., N-1}
00021         int N = wantedVehicle.size();
00022         List<String> tmpId = new LinkedList<String>();
00023         for (int i=0; i<N; i++) {
00024             tmpId.add("" + i);
00025         }
00026         Random rnd = new Random(seed);
00027         for (int i=0; i<N; i++) {
00028             int num = rnd.nextInt(tmpId.size());
00029             String val = tmpId.remove(num);
00030             vehicleNewId.add(val);
00031         }
00032     }


The documentation for this class was generated from the following file:

Generated on Wed May 5 00:07:02 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6