Construct Javascript function for prize distribution
$50 USD
货到付款
We need a Javascript function developed for a prize distribution calculation between a variable number of users. The prize users receive should progressively increase based on their rank in the leaderboard. I will explain the structure of the function below and will try to be as detailed as possible. However, feel free to ask any questions you might have.
This function need to accept a couple of parameteres, and the return value of the function must be an array of prize values. The function should look like this:
function prizeDistribution(totalPrizeValue, amountOfWinners, distributionSpread, returnInt = false) {
... Javascript math magic here ...
}
Please write "I understand" in your bid to verify that you have read and understood my project description.
The variables inside the function is explained below:
totalPrizeValue: This is the prize amount that must be distributed between the winners. totalPrizeValue will always be an interger.
amountOfWinners: This is the amount of users that the prize amount should be distributed to. amountOfWinners will always be an interger.
distributionSpread: This is the spread which determines how much bigger the first prize is than the second etc. Since you are doing the math calculations, you will decide if it makes sense for the distributionSpread variable to be an int or a float number.
returnInt = false: this parameter decides whether the return values in the array should be intergers or float numbers. If true, then it must use [login to view URL](number); to calculate interger.
项目ID: #8274075
关于项目
有8名威客正在参与此工作的竞标,均价$51/小时
I understand .........................................................................................
I understand This is first job for me.. I do it for fidback priority, money not main, not important in first time.. Thank You..
Ok, I guess I understand, I just give some examples of how I think the function should work: prizeDistribution(15, 3, 1, true) = [6, 5, 4] prizeDistribution(15, 3, 7, true) = [12, 5, -2] <-- or maybe negative prices 更多