add: random()

This commit is contained in:
hyb1996
2017-07-30 15:55:22 +08:00
parent 99d9d4b7a8
commit b3bc83d1a2
2 changed files with 21 additions and 3 deletions

View File

@@ -19,6 +19,8 @@ module.exports = function(__runtime__, scope){
return !isStopped();
}
scope.isRunning = scope.notStopped;
scope.exit = function(){
__runtime__.exit();
}
@@ -55,5 +57,12 @@ module.exports = function(__runtime__, scope){
}
}
scope.random = function(min, max){
if(arguments.length == 0){
return Math.random();
}
return Math.floor(Math.random() * (max - min + 1)) + min;
}
scope.setScreenMetrics = __runtime__.setScreenMetrics.bind(__runtime__);
}