Skip to content
Advertisement

Anylogic: Use individual RandomNumberGenerator for each ressource

We are working on a simulation of a production chain of six machines connected in a series. For all of them, we need failure times etc. which are distributed differently.

I am looking for a way to implement an individual RNG for each of the resources used. We need six different RNGs. Unfortunately, we struggle to understand how to implement and use this. Anylogic docu does not really help/explain. It says something about using the Java Random Class.

The example says: triangular( 5, 10, 25, myRNG ) – how to implement myRNG and is it an object or a number?

Advertisement

Answer

The myRNG that you state in your question has to be an instance of the class Random or of a subclass of Random.

Random is a Java class that you can freely use. To generate an instance of that class you would need to do Random rand=new Random(); or you can use it directly in your distribution:

triangular( 5, 10, 25, new Random() ) 

Now a subclass is another class, different than the Random class, but inherits all of its properties. To create a subclass, you need to do it by yourself and learn Java in general and as a newbie I don’t see why you would need it.

If you want 6 different RNG, i guess you would be ok with seeds in your random class so you can define and index that states each one of your seeds and do

triangular( 5, 10, 25, new Random(seeds.get(index)) ) 

assuming you have a collection called seeds that stores all the seeds you want to use.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement