Generate a random UUID.
504477
def uuid4():
    """"""
    # Otherwise, get randomness from urandom or the 'random' module.
    try:
        import os
        return UUID(bytes=os.urandom(16), version=4)
    except Exception:
        import random
        bytes = [chr(random.randrange(256)) for i in range(16)]
        return UUID(bytes=bytes, version=4)
447560
def uuid_to_uid(uuid)
      uuid = Integer(uuid)
      if uuid >= 0 && uuid <= MAX_UUID
        10_000 + uuid
      else
        raise RangeError, "#{uuid} is not within (0..#{MAX_UUID})"
      end
    end
732237
def human_uuid():
    """"""
    return base64.b32encode(
        hashlib.sha1(uuid.uuid4().bytes).digest()).lower().strip('=')
100760
def generate_seed(seed):
    """"""
    if seed is None:
        random.seed()
        seed = random.randint(0, sys.maxsize)
    random.seed(a=seed)

    return seed
816180
def generate_uuid_based_oid(length=None):
    
    length = min(length or OID_LENGTH, OID_MAX_LENGTH)

    while True:
        yield uuid.uuid4().hex.upper()[:length]
556966
def _random_id(self, size=16, chars=string.ascii_uppercase + string.digits):
        
        return ''.join(random.choice(chars) for _ in range(size))
1319438
def random_id(k=5):
  """"""
  #  https://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python
  return ''.join(random.choices(string.ascii_lowercase + string.digits, k=k))
1234185
def prepare_uuid(data, schema):
    
    if isinstance(data, uuid.UUID):
        return str(data)
    else:
        return data
766735
def generate_user(self):
    '''
    '''
    token = str(uuid.uuid4())
    return self.generate_subid(token=token, return_user=True)
16088
@Override
    public Object generate(Client<?> client, String dataType)
    {
        return UUID.randomUUID().toString();
    }
946856
public static String randomUUID() {

        String base = CmsUUID.getNullUUID().toString();
        String hexDigits = "0123456789abcdef";
        StringBuffer result = new StringBuffer();
        for (int i = 0; i < base.length(); i++) {
            char ch = base.charAt(i);
            if (ch == '-') {
                result.append(ch);
            } else if (ch == '0') {
                result.append(hexDigits.charAt(Random.nextInt(16)));
            }
        }
        return result.toString();
    }
127619
function UUIDcreatePart (length) {
    var uuidpart = '';
    for (var i = 0; i < length; i++) {
        var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
        if (uuidchar.length === 1) {
            uuidchar = '0' + uuidchar;
        }
        uuidpart += uuidchar;
    }
    return uuidpart;
}
1262853
def rand_uuid
      values = [
        rand(0x0010000),
        rand(0x0010000),
        rand(0x0010000),
        rand(0x0010000),
        rand(0x0010000),
        rand(0x1000000),
        rand(0x1000000),
      ]
      "%04x%04x%04x%04x%04x%06x%06x" % values
    end
93583
def uuid(cls):
        """"""
        if hasattr(cls, '__uuid_primary_key__') and cls.__uuid_primary_key__:
            return synonym('id')
        else:
            return immutable(Column(UUIDType(binary=False), default=uuid_.uuid4, unique=True, nullable=False))
328431
def data_to_uuid(data):
    """"""
    string = data_to_hexstring(data)
    return string[0:8]+'-'+string[8:12]+'-'+string[12:16]+'-'+string[16:20]+'-'+string[20:32]
212039
function uuids (count, callback) {
    if (typeof count === 'function') {
      callback = count
      count = 1
    }
    return relax({ method: 'GET', path: '_uuids', qs: { count: count } }, callback)
  }
473204
def gen_random_key(size=32):
    
    import os
    if hasattr(os, "urandom"): # Python 2.4+
        return os.urandom(size)

    # Try using PyCrypto if available
    try:
        from Crypto.Util.randpool import RandomPool
        from Crypto.Hash import SHA256
        return RandomPool(hash=SHA256).get_bytes(size)

    except ImportError:
        print >>sys.stderr, "WARNING: The generated key will not be cryptographically-secure key. Consider using Python 2.4+ to generate the key, or install PyCrypto."

        # Stupid random generation
        import random
        L = []
        for i in range(size):
            L.append(chr(random.randint(0, 255)))
        return "".join(L)