Random (Weighted) Selector

can Jow Forums suggest software or a site that does this?

>indie game I'm working for is holding giveaway
>players earn points by reaching in-game milestones

a player's chance of winning the giveaway
is based on what proportion/% of the total points they hold

eg: 100 players earned 6000 total points
if Bob earned 300 of those points
his chance of winning is 1/20 instead of 1/100

so what program should i use
that lets me assign every user a score,
and can randomly select a winner based on that?

Attached: dice.jpg (1146x860, 95K)

Other urls found in this thread:

google.com
rpg.stackexchange.com/questions/121999/can-anydice-com-handle-weighted-dice
commentpicker.com/
youtube.com/watch?v=rkwAKkGKOBU&feature=youtu.be&t=85
twitter.com/NSFWRedditImage

Have you tried having an IQ higher than 20?

>python one-liner

is there something obvious I'm missing, or?...
I know it's probably possible to make a script that does this,
but I can't code, and since we're selecting the winner in a livestream
it'd be better if it was a more 'official solution'

google.com

pic related is what I mean,
except its hundreds of people, not 10

I've looked for over an hour, these are the only kinds of programs I've been able to find
>coin flip
>random name selector
(it's alway 1/N people, not what I'm looking for)
>random number generator
>random cards
>random name/username generator
>random YouTube comment selector

haven't been able to find a single thing that lets me choose the percentage for each option

Attached: chanc.jpg (1177x296, 36K)

rpg.stackexchange.com/questions/121999/can-anydice-com-handle-weighted-dice

>Something obvious i am missing.
Basic math skill? Basic logical deduction? Basic coding skill? Are there no coders on your team? Why are u asking g

thank you user!
trying it out now

lmao why are you guys so sour and joyless?
>Basic math skill?
yep
>Basic logical deduction?
yep
>Basic coding skill?
already said I can't, now who lacks deductive skills?
>Are there no coders on your team?
yes but they're preoccupied with other work,
the giveaway is mine to deal with apparently

Have you ever heard of an "if statement"?

>indie game
cool what game :3

You are retarded.
Just divide one by another, what the fuck, user?

Is this thread a stealth satire of indie devs' poor skills?

I guess I didn't communicate clearly enough...

I understand that dividing an individual's points by the total points, gives me the percentage
>eg: 50/1000 = 1 in 20 aka 5% chance of winning
and I know that this could easily be put into a script,

but we don't WANT to use some cobbled together script to select the winner
our team wants it to be more 'official' looking,
like how youtubers select random comments for giveaways, eg:
>commentpicker.com/
>youtube.com/watch?v=rkwAKkGKOBU&feature=youtu.be&t=85
we want it to be like this ^

Attached: randompickerwebsite.jpg (1271x616, 100K)

How the fuck are you developing a game? Irregardless, I suggest you use Last Measure. It's a pretty broadly focused calculator/measurement converter/randomness tool. It works just right for many people.

There mifht be simpler solution but whatever:
Construct a binary three where leafs are items and parent node holds sum of weights of children nodes.
Root node thus has value of SUM of all item values.
Roll in [0, SUM]
If roll is smaller than the value of left node, proceed there.
If roll is higher or equal than the value of left node, subtract it from roll and proceed to right subtree.
Recursively get to the leaf to pick.

Let me guess, you've recently "upgraded" from FizzBuzz to parsing binary trees.

Why not just do a system where 1 point = 1 entry into your contest?
So if Jim has 200 points and sherry has 15 points, Jim has 200 entries and sherry 15

Ok just an array could be simpler and there are no advantages for bintree.

Put all valuea into array, get sum of all values.
Roll in [0, SUM]
From i in o..len:
If roll < value[i], pick it
Else roll -= value[i] and continue in loop

Addition of item: just appens it
Change of value: also trivial
Deletion of item: could be O(n) but you can set it to 0 in O(1)

Everything is O(log n) on bintree

If there is 6000 points then give a name to all the numbers between 1 and 6000 then. And just choose a random number between 1 and 6000.

>using this as an example
>being unable to do this without asking Jow Forums
OP are you female? go to /sqt/

So you want a random wighted picker or a tool to scan comments for specific phrases? you are confusing.

Poo n Loo

Exactly how i (not OP) would do it

over complicating things friends

from random import randint
pairs = [("Alice", 20), ("Bob", 100), ("Charlie", 30), ("Dean", 40), ("Emma", 80), \
("Fred", 150), ("Gary", 30), ("Harriet", 60), ("Isabelle", 40), ("Jack", 80)]
winrar = randint(0, 640)
count = 0
for name, points in pairs:
count += points
if winrar

it's the same thing except you add to count instead of subtracting from winrar
technically with subtracting you have 1 variable less, thus it's simpler