From: Ezra Zygmuntowicz Date: 2008-09-02T06:27:02+09:00 Subject: Re: generate uuid On Aug 31, 2008, at 6:12 PM, Heesob Park wrote: > 2008/8/28 Newb Newb : >> How Can I generate uuid ? any references or Ideas could You people >> suggest.I have not even heard about it? > > You get get UUID on the WEB like this: > > require 'open-uri' > uuid = open('http://www.famkruithof.net/uuid/uuidgen'). > read.scan(/

([-[:alnum:]]+)<\/h3>/).to_s > puts uuid > > Regards, > > Park Heesob One thing I;ve found is that all of the UUID generators are painfully slow if you need to make a bunch of uuid's. Here is a way to cheat, but do so at your own risk as this is not garaunteed to be as safe as a true uuid but in practice works very well. def fast_token values = [ rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x1000000), rand(0x1000000), ] "%04x%04x%04x%04x%04x%06x%06x" % values end Cheers- -Ezra