added: #genTimestampUUID
authorStefan Vogel <sv@exept.de>
Fri, 12 Mar 2010 12:56:52 +0100
changeset 2431 ba791db4a743
parent 2430 58d74ec1aa74
child 2432 77c3b2c22e9c
added: #genTimestampUUID comment/format in: #genRandomUUID
UUID.st
--- a/UUID.st	Fri Mar 12 12:56:35 2010 +0100
+++ b/UUID.st	Fri Mar 12 12:56:52 2010 +0100
@@ -195,6 +195,16 @@
     "
 !
 
+genTimestampUUID
+    "generate a new timestamp UUID"
+
+    ^ (super basicNew:16) genTimestampUUID
+
+    "
+      self genTimestampUUID
+    "
+!
+
 genUUID
     "generate a uuid.
      If a physical mac address can be retrieved from the OS,
@@ -472,10 +482,19 @@
     "
 
     "
+      |uuids sample|
+      sample := 100000.
+      uuids := Set new:sample.  
+      sample timesRepeat:[
+          uuids add:UUID genRandomUUID.
+      ].
+      self assert:(uuids size = sample)  
+
+
       1 to: 100 do:[ : el |
           Transcript show:el.
           Transcript show:': '.
-          Transcript showCR:(UUID new genRandomUUID).
+          Transcript showCR:(UUID genRandomUUID).
       ].
     "
 !
@@ -678,11 +697,11 @@
 !UUID class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.32 2010-03-06 13:19:41 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.33 2010-03-12 11:56:52 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.32 2010-03-06 13:19:41 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.33 2010-03-12 11:56:52 stefan Exp $'
 ! !
 
 UUID initialize!