Computer Science, asked by iamlall427, 1 year ago

produce random numbers with more probabiltiy for one number javascript

Answers

Answered by Anonymous
1

Hi,

function moreProbabiltiy() {

var moreProbabiltiyNumber = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4];

var index = Math.floor(Math.random() * moreProbabiltiyNumber.length);

return moreProbabiltiyNumber[index];

}


above function will increase the probability of numbers in array.


Similar questions