From: Mohit Sindhwani Date: 2008-08-31T17:41:05+09:00 Subject: Re: generate uuid Lex Williams wrote: > Newb Newb wrote: > >> How Can I generate uuid ? any references or Ideas could You people >> suggest.I have not even heard about it? >> > > http://en.wikipedia.org/wiki/Uuid#Ruby > In Windows, you can use this code. I'm not sure where I found this from, so I can't tell you who to thank :P require 'Win32API' @uuid_create = Win32API.new('rpcrt4', 'UuidCreate', 'P', 'L') def new_guid result = ' ' * 16 @uuid_create.call(result) a, b, c, d, e, f, g, h = result.unpack('SSSSSSSS') sprintf('{%04X%04X-%04X-%04X-%04X-%04X%04X%04X}', a, b, c, d, e, f, g, h) end puts new_guid Cheers, Mohit. 8/31/2008 | 2:28 PM.