Created by [CecilWesterhof]. '''Getting an UUID on a *NIX System''' There are some problems with getting the UUID (type 4) on *NIX systems. For one they are not really random. Because of this I created the following function: ====== proc getUUIDNix {{secure False}} { set fortyeightBits [expr {2 ** 48 - 1}] set sixteenBits [expr {2 ** 16 - 1}] set thirtytwoBits [expr {2 ** 32 - 1}] set twelfBits [expr {2 ** 12 - 1}] format %.8x-%.4x-4%.3x-%x%.3x-%.12x \ [getRandomIntInRangeNix 0 ${thirtytwoBits}] \ [getRandomIntInRangeNix 0 ${sixteenBits}] \ [getRandomIntInRangeNix 0 ${twelfBits}] \ [getRandomIntInRangeNix 8 11] \ [getRandomIntInRangeNix 0 ${twelfBits}] \ [getRandomIntInRangeNix 0 ${fortyeightBits} False True] } ====== It uses getRandomIntInRangeNix from [Random Integers]. ---- As always: comments, tips and questions are appreciated. ---- '''[ak] - 2018-05-31 18:28:08''' See also https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/uuid/uuid.html <>Linux | Utilities