vm/src/lib.js
function (min, max) {
			if (min === undefined && max === undefined) return getRandom();
	
	
			if (typeof min !== 'number') throw new shine.Error("bad argument #1 to 'random' (number expected)");
	
			if (max === undefined) {
				max = min;
				min = 1;
	
			} else if (typeof max !== 'number') {
				throw new shine.Error("bad argument #2 to 'random' (number expected)");
			}
	
			if (min > max) throw new shine.Error("bad argument #2 to 'random' (interval is empty)");
			return Math.floor(getRandom() * (max - min + 1) + min);
		}
function (min, max) {
			if (min === undefined && max === undefined) return getRandom();
	
	
			if (typeof min !== 'number') throw new shine.Error("bad argument #1 to 'random' (number expected)");
	
			if (max === undefined) {
				max = min;
				min = 1;
	
			} else if (typeof max !== 'number') {
				throw new shine.Error("bad argument #2 to 'random' (number expected)");
			}
	
			if (min > max) throw new shine.Error("bad argument #2 to 'random' (interval is empty)");
			return Math.floor(getRandom() * (max - min + 1) + min);
		}
function ( min , max ) { if ( min === undefined && max === undefined ) return getRandom ( ) ; if ( typeof min !== 'number' ) throw new shine . Error ( "bad argument #1 to 'random' (number expected)" ) ; if ( max === undefined ) { max = min ; min = 1 ; } else if ( typeof max !== 'number' ) { throw new shine . Error ( "bad argument #2 to 'random' (number expected)" ) ; } if ( min > max ) throw new shine . Error ( "bad argument #2 to 'random' (interval is empty)" ) ; return Math . floor ( getRandom ( ) * ( max - min + 1 ) + min ) ; }
Implementation of Lua's math.random function.
Implementation of Lua s math . random function .