scala solution
Fisher\u2013Yates shuffle\nscala []\nclass Solution(_m: Int, _n: Int) {\n  val aMap = collection.mutable.Map.empty[Int,Int]\n  val mn = _m*_n; var sz = mn\n  de
[Fisher\u2013Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)\n```scala []\nclass Solution(_m: Int, _n: Int) {\n  val aMap = collection.mutable.Map.empty[Int,Int]\n  val mn = _m*_n; var sz = mn\n  def flip(): Array[Int] = {\n    val nxtRndD = util.Random.nextDouble().abs\n    val nxtRnd = ((util.Random.nextDouble().abs) * (sz)).toInt\n    sz -= 1\n    val nxt = aMap.getOrElse(nxtRnd,nxtRnd)\n    aMap(nxtRnd) = aMap.getOrElse(sz,sz)\n    aMap -= sz\n    Array(nxt / _n, nxt % _n)\n  }\n  def reset(): Unit = {aMap.clear(); sz = mn}\n}\n\n/**\n * Your Solution object will be instantiated and called as such:\n * val obj = new Solution(m, n)\n * val param_1 = obj.flip()\n * obj.reset()\n */\n```
['Hash Table', 'Reservoir Sampling', 'Randomized', 'Scala']