www.webdeveloper.com
Results 1 to 4 of 4

Thread: Unique Id Generation

  1. #1
    Join Date
    Apr 2003
    Location
    india
    Posts
    5

    Exclamation Unique Id Generation

    i want 2 know how to generate a unique id using javascript .
    i have 2 follow 2 things while generating a unique id .
    1.) it should be in short range (1 to 32,767)
    2.) without refering to previous generated id's i have to generate the other id's
    Do any one have idea or clue to do this ???
    Regards ,
    K.Ramesh

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    I can satisfy 2) but not 1).

    var uniqueId = new Date().getTime()
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Apr 2003
    Location
    india
    Posts
    5
    Hi ,
    thanks . i am also trying using date object only . but i need 2 satisfy both condns ...

    currentTime.getSeconds() will always return the unique id within a miniute (0-59 - With in short range)

    currentTime.getSeconds()+""+currentTime.getMinutes()) will always return a unique id within a hour .(0-5959 With in short range)

    currentTime.getSeconds()+""+currentTime.getMinutes()+""++currentTime.getHours()) will always return a unique id within a day .(0-595923 NOT With in short range)

    so here only my problem arises . if 3rd condn satisfies i will b done . in this way i dont need to store the id's and refer it back . can u help me something similar to this .
    waiting for ur reply
    Thanks & Regards ,
    Ramesh

  4. #4
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    Sounds like a tough call,I have a feeling that other then storing the values in an array you will find it hard to get a solution

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles