|
@@ -573,10 +573,16 @@ Integer function modulo(a:Integer,b:Integer):
|
|
|
|
|
|
|
|
Integer RandomNumberState
|
|
Integer RandomNumberState
|
|
|
Integer function getRandomNumber(min:Integer, max:Integer):
|
|
Integer function getRandomNumber(min:Integer, max:Integer):
|
|
|
|
|
+ //returns a random integer in min and max range, never max
|
|
|
|
|
+ if(min==max):
|
|
|
|
|
+ return min
|
|
|
if( bool_not(is_physical_int(RandomNumberState))):
|
|
if( bool_not(is_physical_int(RandomNumberState))):
|
|
|
RandomNumberState = 4 // xkcd.com/221/
|
|
RandomNumberState = 4 // xkcd.com/221/
|
|
|
RandomNumberState = modulo((8121*RandomNumberState) + 28411, 134456)
|
|
RandomNumberState = modulo((8121*RandomNumberState) + 28411, 134456)
|
|
|
- return modulo(RandomNumberState , (max-min)+1)+min
|
|
|
|
|
|
|
+ return modulo(RandomNumberState , (max-min))+min
|
|
|
|
|
+
|
|
|
|
|
+Element function list_select_random(list:Element):
|
|
|
|
|
+ return list_read(list, getRandomNumber(0,read_nr_out(list)))
|
|
|
|
|
|
|
|
|
|
|
|
|
Element function tf_executeARule(tf_er_transformation: Element,tf_er_rule: Element, tf_er_model: Element, pivots : Element):
|
|
Element function tf_executeARule(tf_er_transformation: Element,tf_er_rule: Element, tf_er_model: Element, pivots : Element):
|
|
@@ -609,6 +615,13 @@ Element function tf_executeARule(tf_er_transformation: Element,tf_er_rule: Eleme
|
|
|
Element final_matches
|
|
Element final_matches
|
|
|
final_matches = mergeLHSNAC(tf_er_lhs, tf_er_nac)
|
|
final_matches = mergeLHSNAC(tf_er_lhs, tf_er_nac)
|
|
|
|
|
|
|
|
|
|
+ //select only one match
|
|
|
|
|
+ Element selected
|
|
|
|
|
+ selected = list_select_random(final_matches)
|
|
|
|
|
+ final_matches = create_node()
|
|
|
|
|
+ list_append(final_matches, selected)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//extract pivots from the matches
|
|
//extract pivots from the matches
|
|
|
extractPivots(final_matches, pivots, tf_er_transformation, tf_er_model)
|
|
extractPivots(final_matches, pivots, tf_er_transformation, tf_er_model)
|
|
|
|
|
|