Problem Generating ID
Hi All, I am generating a ID to use as primary key in my table with the follwing code. double regno = (double)System.currentTimeMillis() * Math.random(); I am getting the result in exponential form (5.797797409006919E11) . But I do not want the result in exponential form, but like for eg something like 57977974090069.3219 is there a way out? thanks Bopanna Power of Global Information Access... .. Browser based RCS products. - Visit us at http://www.rcssoft.com/ for an online DEMO of all our web based products. User ID and Password will be available on request. PAYMAN - Payroll Management System TRAXX - Asset Management and Tracking System eSHOP - Online Information and Ordering System SALES STREAM - Sales Force Automation CARE - Call Management System DATA MINER - Query Builder and Report Generator Please write to [EMAIL PROTECTED] or reply to this mail for further details. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem Generating ID
Hi, why would you want to multiply the currentTimeMillis with math random ? The currentTimeMillis is unique onto itself? If you are concerned with multiple threads isn't is easier to append a thread id instead of risking two id that are the same because of the randomness introduced? greetz Hans At 03:26 PM 8/12/2003 +0530, N.B.Bopanna wrote: Hi All, I am generating a ID to use as primary key in my table with the follwing code. double regno = (double)System.currentTimeMillis() * Math.random(); I am getting the result in exponential form (5.797797409006919E11) . But I do not want the result in exponential form, but like for eg something like 57977974090069.3219 is there a way out? thanks Bopanna Power of Global Information Access... .. Browser based RCS products. - Visit us at http://www.rcssoft.com/ for an online DEMO of all our web based products. User ID and Password will be available on request. PAYMAN - Payroll Management System TRAXX - Asset Management and Tracking System eSHOP - Online Information and Ordering System SALES STREAM - Sales Force Automation CARE - Call Management System DATA MINER - Query Builder and Report Generator Please write to [EMAIL PROTECTED] or reply to this mail for further details. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem Generating ID
You may find the java.text.DecimalFormat class useful. -Original Message- From: N.B.Bopanna [mailto:[EMAIL PROTECTED] Sent: 12 August 2003 10:57 To: [EMAIL PROTECTED] Subject: Problem Generating ID Hi All, I am generating a ID to use as primary key in my table with the follwing code. double regno = (double)System.currentTimeMillis() * Math.random(); I am getting the result in exponential form (5.797797409006919E11) . But I do not want the result in exponential form, but like for eg something like 57977974090069.3219 is there a way out? thanks Bopanna Power of Global Information Access... .. Browser based RCS products. - Visit us at http://www.rcssoft.com/ for an online DEMO of all our web based products. User ID and Password will be available on request. PAYMAN - Payroll Management System TRAXX - Asset Management and Tracking System eSHOP - Online Information and Ordering System SALES STREAM - Sales Force Automation CARE - Call Management System DATA MINER - Query Builder and Report Generator Please write to [EMAIL PROTECTED] or reply to this mail for further details. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]