Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder fireblade's Avatar
    Join Date
    May 2007
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic and unique number generation?

    How can i create a random and a little long unique number that is miz of numbers and letters??
    Fi®e bLádê
    follow me on twitter

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    Here is a good example
    http://lab.artlung.com/make-unique-id/

    Cheers,
    Ess

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts
    people here have said numerous times mktime() can create a totally unique random number, re-search the forums and look for a solution

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    Quote Originally Posted by rafiki View Post
    people here have said numerous times mktime() can create a totally unique random number, re-search the forums and look for a solution
    mktime wouldnt be random or contain letters. Timestamps are unique-ish but for with high traffic you could get 500-1000 all with the exact same timestamp. If you're using a timestamp as the basis of your random number use microtime instead, you're 1,000,000 times more likely to get a unique value than with time or mktime.

    You could start with microtime as the basis of your unique then randomly select certain digits to convert to a letter (between A and J). It would be unique and contain both letters and numbers but it would be pretty long.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •