## Ranked Simulations

This is the place for queries that don't fit in any of the other categories.

### Ranked Simulations

Hello everyone!

I've been working with simulations lately, we've had to run these simulations for how certain groups do relative to each other. I've thought of using python to build a better, more automated model. While conceptually I know what I want to do, in theory I've had some trouble.

Basically, every group is assigned a variable. In this group of 10, each group receives a value. The most highly ranked group is 10, the lowest is 1.

a = 10
b = 9
c = 8
d = 7
e = 6
f = 5
g = 4
h = 3
i = 2
j = 1

If two groups are compared to each other, there is a higher probability of the more highly ranked group 'winning'. So a has the best chance of winning while j has the lowest. However, b has a higher chance of beating athan the others. It is also possible for groups to draw. The closer they are to each other, the higher the chance of drawing.

So each group is a variable with the rank stored in it. Then the idea is to get a random number that if added to the lower ranked group will yield a result. So let's say the number is 2

If the simulation compares a to b, then b would win as the end result of b would be b + 2 (11). If the random number is 1 then there is a draw, and if the number is 0, then a wins. But this is where I see two problems.

First of all, I want closely ranked groups to have a more limited set of numbers. so in an a and b simulation, maybe only 0, 1 and 2 would be available, while in the a and c simulation, 0, 1, 2, and 3 would be available. The reason behind this is because if the range is too high for closely ranked groups, the lower group has a higher chance of winning.

The second problem, and, actually, the primary problem is how to generate the limited range of random numbers.

Any hints, tips and suggestions would be great!

Thanks!
Last edited by Yoriz on Thu Nov 14, 2013 4:55 pm, edited 1 time in total.
Reason: first post lock
technographie

Posts: 1
Joined: Thu Nov 14, 2013 2:29 pm

### Re: Ranked Simulations

What attempts have you made? Read this to know how to make a post that will get answered quickly and well.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

micseydel

Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

### Re: Ranked Simulations

Regarding the 1st part of your question, I think you've found the answer yourself:
technographie wrote:I want closely ranked groups to have a more limited set of numbers. so in an a and b simulation, maybe only 0, 1 and 2 would be available, while in the a and c simulation, 0, 1, 2, and 3 would be available. The reason behind this is because if the range is too high for closely ranked groups, the lower group has a higher chance of winning.

More generallly, the range you need to pick a random number from will be
Code: Select all
`abs(g1-g2)+1 # where g1 and g2 are any of your a,b,c,d,e....`

As for the 2nd part: I agree with micseydel, but to make it yet more shameful for you: lmgify.
ochichinyezaboombwa

Posts: 203
Joined: Tue Jun 04, 2013 7:53 pm