problem description
Theparameter is [number, distance] to find out the point coordinates satisfied in the two-bit plane of the browser.
number: the number of coordinate points in the two-bit plane of the browser.
distance: the distance between each coordinate point must be less than this distance.
related codes
/**
     * :
     * :(px)
     */
    function starList() {
        var list = [], //list
            arg = [].slice.call(arguments), //
            number = arg[0] || 10, //
            distance = arg[1] || 100, //
            domBody = document && document.body || {
                clientWidth: 1920,
                clientHeight: 1080
            },
            maxW = domBody.clientWidth,
            maxH = domBody.clientHeight;
            if(typeof number!=="number"){
                 throw("number");
                
            }
            if(typeof distance!=="number"){
                throw("number");
            
           }
           if(number*distance>Math.min(maxW,maxH)){
                throw("");
            }
        return {
            init: function (callback) {
                callback = callback || function () {};
                if(typeof callback!=="function"){
                    throw("function");
                    
                }
                this.pushList(); //
                callback(list);
            },
            /**
             * 
             */
            pushList: function () {
                //
                if (list.length === number) {
                    return;
                }
                var point = this._random(maxW, maxH, 0);
                if (this.judgeDistances(point)) {
                    list.push(point);
                    this.pushList();
                } else {
                    //
                    this.pushList();
                }
            },
            /**
             * 
             */
            _random: function (maxw, maxh, min) {
                return {
                    x: parseInt(Math.random() * (maxw - min + 1) + min, 10),
                    y: parseInt(Math.random() * (maxh - min + 1) + min, 10)
                };
            },
            /**
             * 
             */
            judgeDistances: function (point) {
                var l = list.length;
                while (l--) {
                    //distance false 
                    if (Math.abs(list[l].x - point.x) < distance || Math.abs(list[l].y - point.y) < distance) {
                        return false;
                    }
                }
                return true;
            }
        }
    };
    var creatStar = starList(20,26);//265045
     creatStar.init(function(list){
       console.log(list);
     });/ / as a result, there is a stack explosion. I would like to ask if the boss has a good solution.
