The weighted draft lottery system the NBA has used to determine the top-three picks in the draft has been in place since 1990. There have been a few tweaks with more teams coming into the league since then, but the general process has remained the same. So how does it work?

Because there are 14 non-playoff teams, 14 ping-pong balls numbered 1-14 are placed in a lottery machine. The balls are mixed for 20 seconds before the first ball is drawn. The remaining balls are then mixed for 10 seconds before the second ball is drawn. This process is repeated until four balls have been drawn to create a four-digit combination to determine the No. 1 pick.

There are 1,001 total combinations available, with one of those combinations thrown out and the other 1,000 combinations distributed among the teams. The worst team in the league gets 250 combinations, and the odds get worse for each subsequent team.

The team with the best record in the lottery only gets five combinations. If two teams finish the season with the same record, each tied team gets the average of the total number of combinations for the draft positions they hold. If the resulting average isn't an integer, a coin flip is done to see who gets the extra combination.

Here are the combinations and odds for this year's lottery, via Posting and Toasting:

After the No. 1 pick is determined, the same process is repeated for the second and third picks. Once those top-three picks are determined, the rest of the draft order goes in reverse order in terms of win-loss record.

Because the drawing of the ping-pong balls isn't shown on television, conspiracy theories always pop up about the lottery being rigged. However, as Jeff Zillgitt of USA TODAY Sports details, the NBA goes to great lengths to make sure no rigging takes place:

The NBA uses a representative from the accounting firm Ernst and Young to oversee the process, which is conducted just before the TV broadcast of the event. The ping-pong selection is done in a separate room, and inside the room are NBA officials, reporters, Denise Pelli from Ernst and Young, representatives from each of the 14 lottery teams, a ping-pong machine operator and timekeeper. The people in the room are sequestered without communication devices until the No. 1 pick is revealed on the TV broadcast. Here is a video from last year's lottery.

With so many people in the room and part of the process, it's just about impossible to rig the lottery.