## kilise's Profile User Rating:

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
3 (0 per day)
Joined:
16-February 12
Profile Views:
99
Last Active:
Feb 19 2012 12:57 PM
Currently:
Offline

### Previous Fields

Dream Kudos:
0
kilise has not set their status

1. #### In Topic: [Question] Problem reached - Professional help

Posted 17 Feb 2012

Wouldn't that overload the server if I have lots of values, also considering that I want the first rank should have a greater probability than the second which would make me have to put lots of values into the array?
2. #### In Topic: [Question] Problem reached - Professional help

Posted 17 Feb 2012

```function pickRank() {
var x = Math.sqrt(rand(1, Math.pow(topRank + 1, 2)));
var y = Math.floor((Math.abs(x)));
var v = (topRank + 1) - Math.ceil(y);

if(v==0)
return pickRank();
else
return v;
}

```

It was written in Javascript though, to later be converted to PHP since I didnt have a webserver available when I wrote it, but it's a small code so.... "topRank" is the maximum rank found in the database, so it will pick one of the ranks between 1-topRank and giving the 1st rank a greater chance to be picked by using random values with pow and then flooring the sqrt'd value and inverting it at the "v" variable... But the problem with this was that I realized as there could be more people in one group of ranks, say there is 4 people with same rank (e.g. 1) then they would practically have 4 times lesser chance as it has to be divided between them if the rank was picked, while if say rank 5 was picked and nobody else or less people is in it then after being picked if there was just one person having this rank he would be chosen at once. I have to somehow load the ranks from the database and see how many is in each rank to even out the numbers through some algorithm but I can't seem to figure how I would do that.

Member Title:
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

E-mail:
Private

### Friends

kilise hasn't added any friends yet.