The coding looks correct, so I'm thinking that it's something in your calculations. One thing that makes it difficult to determine is your usage of $rand in the calculation of %exp & %money.

It might help if you would give us an example of what you're getting versus what you would be expecting to get.

Also, for future reference, when posting code, please use the Code Tags