JSFiddle - React, Tailwind, and code Playground

by Khalil Zhang

JavaScript

function SubMath() {}

SubMath.prototype = Math;
var random = Math.random;
SubMath.prototype.random = function () {
  var min = 0;
  var max = 9;

  return min + Math.floor(random() * (max - min + 1));
}

var subMath = new SubMath();
alert(subMath.random());