Construct Javascript function for prize distribution

进行中 已发布的 Aug 15, 2015 货到付款
进行中 货到付款

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.

JavaScript 软件构架 软件开发

项目ID: #8274075

关于项目

8个方案 远程项目 活跃的Aug 15, 2015

有8名威客正在参与此工作的竞标,均价$51/小时

rodweb

I understand .........................................................................................

$50USD 在1天里
(33条评论)
5.4
sashlex

I understand This is first job for me.. I do it for fidback priority, money not main, not important in first time.. Thank You..

$50 USD 在2天内
(0条评论)
0.0
pstrivedi

A proposal has not yet been provided

$55USD 在1天里
(0条评论)
0.0
schmitthenner

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 更多

$50USD 在1天里
(0条评论)
0.0