It goes by the highest number available. So if you are entering 102 and someone else enter 103 you will get next 104.
Also receipt number really should not mean anything. It seems like you are using receipt number for something thats why you care what the number is. What are you using receipt number for. We might have a different solution for that.