Hello, I need to generate a unique ID, so far I’ve unit tested this
under 100000 iterations and it seems to work :
now.to_i.to_s + ‘-’ + now.usec.to_s + ‘-’ + rand(1000).to_s
Is there a better way ?
- without usec, few percents of generated values are not uniques
- the id generated is a string so the presence of ‘-’, this is only for
a better readibility in case of SQL debugging