Creating tokens with random value

640 Views Asked by At

In the petrinet shown below i have a problem creating tokens with random value in place input2, since the rand() function doesn't seem to work. Is there any other way to do it? enter image description here

1

There are 1 best solutions below

0
On

CPN ML provides random choice of color for small color sets. You could use SmallInt.ran() for a random integral number in the range [1,10].

REAL is not a small color set and if you were to use REAL.ran() you would get an exception.

I would guess that a suitable solution for your example would be to use 1.0/real(SmallInt.ran()).

I do not have a copy of CPN Tools at hand so please take the above advice critically.