You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Pradeep Arumalla <pr...@gmail.com> on 2007/01/10 21:48:11 UTC

UUID number generation problem

hi all,
  I am trying to understand how the UUID generation works, I am trying to
run the *code snippet 1  *,100 times, and it prints the same number 100
times, Is it not supposed to print a different number eachtime.And If I run
the *code snippet 2  * 100 times, I get a    different number each time .The
documentation says *code snippet 1*   is efficient than *code snippet
2.  ,*forgive my ignorance
*.* Please help
**
**
**
**
*code snippet 1 :*
**
for ( int i=0; i<100; i++){
   System.out.println("*******"+ UUID.nameUUIDFromString("namespace",new
UUID("f807f2fc-b49b-4512-a787-92300367b932"),UUID.SHA1_ENCODING));
  }


*code snippet 2 :*
**
for ( int i=0; i<100; i++){
   System.out.println("******* "+UUID.randomUUID().toString());
  }

Thanks
Pradeep