Finalizing the beta version of the implementation for Groovy extension in JPF: JPF...
[jpf-core.git] / examples / Rand.groovy
index 53f483f4fe1f04b2b8d0fa7b889870507a93023d..4d6ff322829afbdd856963a698e2b22b463ac2d4 100644 (file)
@@ -1,10 +1,15 @@
-int rand = Math.random()*10
+class Rand {
+       static void main (String[] args) {
+               println("Groovy model-checking")
+               Random random = new Random(42);
+       
+               int a = random.nextInt(2)
+               int b = random.nextInt(3)
+               println("a=" + a)
+               println("  b=" + b)
 
-if (rand < 5) {
-       //println "rand is less than 5: "
-       System.out.println(rand)
-} else {
-       //println "rand is greater than or equal to 5: "
-       System.out.println(rand)
+               int c = a/(b+a -2)
+               println("    c=" + c)
+       }
 }