Why not just UUIDGenerator default next hex asUppercase. Or even UUID new hex asUppercase. ? Since you are using #generateBytes:forVersion: (which is an internal method BTW), you must be working in an older Pharo image (older than 6). We replaced the UUIDGenerator class, the class comment in from the newer version.
On 17 Jun 2017, at 16:27, horrido <horrido.hobbies@gmail.com> wrote:
Okay, I figured it out. Here's my method:
generateUUID | aStream hex s x | hex := '0123456789ABCDEF'. x := ByteArray new: 16. UUIDGenerator default generateBytes: x forVersion: 4. s := String new: 32. aStream := WriteStream on: s. x do: [ :each | aStream nextPut: (hex at: each // 16 + 1). aStream nextPut: (hex at: each \\ 16 + 1) ]. ^ s
Works like a charm. It would've been nice if a similar example was available /somewhere/ on the web.
-- View this message in context: http://forum.world.st/UUIDGenerator-tp4951725p4951731.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.