Browse Source

selfDefending test implementation

sanex3339 9 năm trước cách đây
mục cha
commit
b5948435ae

+ 1 - 1
src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts

@@ -37,7 +37,7 @@ export class SelfDefendingUnicodeNode extends Node {
             randomIndex: number = 0;
 
         if (programBodyLength > 2) {
-            randomIndex = Utils.getRandomInteger(programBodyLength, programBodyLength / 2);
+            randomIndex = Utils.getRandomInteger(programBodyLength / 2, programBodyLength);
         }
 
         NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);