Random number in Uppaal

2019-04-08 19:22发布

How can I create a random number when I define a global declaration in an Uppaal program?

I want to have a variable that contains a random number as in a C program:

int x = rand (100);

2条回答
手持菜刀,她持情操
2楼-- · 2019-04-08 19:39

I think the proper answer is: it is not possible when defining the global declaration.

The syntax that @Kamiccolo provided I think is misleading: there does not exist a syntactic construct like "select: ..." in Uppaal.

The only possible way, at now, is:

  • add a global variable "int x = 0;"
  • add an initial transition whose "select" clause assign "x : int[0,100]", as the mailing list (and the manual) suggest
查看更多
ら.Afraid
3楼-- · 2019-04-08 19:55

According to folks at Uppaal mailing list , this code snippet select: i : int[0,3]

will non-deterministically bind i to an integer in the range 0 to 3.

So, in Your case just use select: x : int[0, 100].

查看更多
登录 后发表回答