"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var GMath = (function () {
    function GMath() {
    }
    /**
     * 向下取整
     * @param n
     * @returns {number}
     */
    GMath.int = function (n) {
        return n >> 0;
    };
    /**
     * 给数组随机排序
     * @param arr
     */
    GMath.randomArr = function (arr) {
        var len = arr.length;
        for (var i = 0; i < len; i++) {
            var n = this.random(0, arr.length, true);
            var temp = arr[n];
            arr[n] = arr[i];
            arr[i] = temp;
        }
        return arr;
    };
    /**
     * 范围随机数
     * @param n1 范围起始
     * @param n2 范围结束
     * @param int 结果是否返回整数
     * @return {*}
     */
    GMath.random = function (n1, n2, int) {
        var n;
        var min;
        var max;
        if ((typeof n1) != 'undefined' && (typeof n2) != 'undefined') {
            min = Math.min(n1, n2);
            max = Math.max(n1, n2);
            n = Math.random() * (max - min) + min;
        }
        else {
            n = Math.random();
        }
        if (int) {
            n = this.int(n);
        }
        return n;
    };
    return GMath;
}());
exports.GMath = GMath;
__reflect(GMath.prototype, "\"c:/Users/duiba/Documents/zhonghe_answer/egret/libs/tc/util/GMath\".GMath");
//# sourceMappingURL=GMath.js.map