Find Jobs
Hire Freelancers

Construct Javascript function for prize distribution

$50 USD

In Progress
Posted over 8 years ago

$50 USD

Paid on delivery
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.
Project ID: 8274075

About the project

7 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
7 freelancers are bidding on average $51 USD for this job
User Avatar
I understand .........................................................................................
$50 USD in 1 day
5.0 (33 reviews)
5.4
5.4
User Avatar
A proposal has not yet been provided
$55 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
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 are not allowed? Then this would be [11, 4, 0] prizeDistribution(14, 3, 1, false) = [5.6666, 4.6666, 3.6666] prizeDistrubution(14, 3, 1, true) = [5, 4, 3] <-- or should this be something like [5, 5, 4] or [6, 5, 3] to get the right sum? Please clarify!
$50 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of DENMARK
Aalborg, Denmark
5.0
16
Payment method verified
Member since Sep 18, 2012

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.