1
var Solution = function (m, n) {3
this.range = new Array(this.length);8
Solution.prototype.flip = function () {9
let limit = this.length - this.pointer - 1;10
let index = ~~(Math.random() * limit) + this.pointer;12
if (this.range[index] === undefined) this.range[index] = index;13
if (this.range[this.pointer] === undefined)14
this.range[this.pointer] = this.pointer;16
let tmp = this.range[index];17
this.range[index] = this.range[this.pointer];18
this.range[this.pointer] = tmp;20
let a = ~~(this.range[this.pointer] / this.n);21
let b = this.range[this.pointer] % this.n;27
Solution.prototype.reset = function () {