Quote:
How do I create a code for a website that will give a random non repeating number from 1-9999
This is the principle of random numbers, they can be repeated.
Quote:
I want to set up a promotion where ppl get a unique referral number.
They can then send that referral number to friends to enter into a form(to track referrals)
All the interest of a referral number is to give reward to your customers that send you new ones. In order to achieve this, you need to record the referral number in database in order to retrieve the referrer.
You can use any formula that give a unique number to each customer. Since each customer know only 1 referral number, how they are build does not really matter.
ex: start at 2000 and increment of 1: 2000, 2001, 2002, 2003 ...
ex: start at 10000 and increment of 7: 10000, 10007, 10014, 10021 ...