JSFiddle - React, Tailwind, and code Playground

JavaScript

class Country {
	constructor(dr){
  	this.dr = dr;
    this.spy_dr = dr/40;
  }
  
  randomFactor(){ 
  	const max = 1;
		const min = 0;
		return Math.random() * (max - min) + min;
  }
  
  getRate(){
  	return this.randomFactor() > this.spy_dr;
  }
}

const celphi = new Country(10);

// current implementation (i suspect)
console.log(`Success use single lookup: ${celphi.getRate()}`);

// what it should do...
const arr = Array.from({length: 1000}, () => celphi.getRate());

console.log(arr);
const total = arr.filter(x => x).length;
console.log(total/1000);