Generate a unique ID - that is friendly for a URL or file system

@return a unique id
1318
public String generateSanitizedId() {
        String result = this.generateId();
        result = result.replace(':', '-');
        result = result.replace('_', '-');
        result = result.replace('.', '-');
        return result;
    }
328954
def generate_id():
    
    global _current_pid

    pid = os.getpid()
    if _current_pid != pid:
        _current_pid = pid
        _rnd.seed(int(1000000 * time.time()) ^ pid)
    id = format(_rnd.randint(0, 18446744073709551615), '02x')

    if len(id) < 16:
        id = id.zfill(16)

    return id
287546
function _makeId($arguments)
    {
        $id = serialize($arguments); // Generate a cache id
        if (!$this->_fileNameProtection) {
            $id = md5($id);
            // if fileNameProtection is set to false, then the id has to be hashed
            // because it's a very bad file name in most cases
        }
        return $id;
    }
901677
public String addId(final URI id) {
        if (id == null) {
            return null;
        }
        final URI localId = id.normalize();
        index ++;
        final String newId = PREFIX + Integer.toString(index);
        idMap.put(localId, newId);
        return newId;
    }
5652
private String getUserFromUniqueID(String id) {
        if (id == null) {
            return "";
        }
        id = id.trim();
        int realmDelimiterIndex = id.indexOf("/");
        if (realmDelimiterIndex < 0) {
            return "";
        } else {
            return id.substring(realmDelimiterIndex + 1);
        }
    }
35051
def unique_id(self):
        
        cmd = 'svn info | grep "^Repository UUID"'
        cmdo = self.sh(cmd,
                       shell=True,
                       ignore_error=True)
        if cmdo:
            return cmdo.split(': ', 1)[1].rstrip()
        return None
839927
public static String id(Resource res) {
	String str = ResourceUtil.getCanonicalPathEL(res) + "|" + res.length() + "|" + res.lastModified();
	try {
	    return Hash.md5(str);
	}
	catch (NoSuchAlgorithmException e) {
	    return Caster.toString(HashUtil.create64BitHash(str));
	}
    }
251386
@Override
	public String getId() {
		StringBuilder strId = new StringBuilder();
		strId.append(id);
		if (nextProcessor != null) {
			strId.append(",").append(nextProcessor.getId());
		}
		return strId.toString();
	}
938121
public String getId()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getId");

    String id = this.getUuid();
   //we need something unique - therefore cannot use 
   //just topic space ID
   id += this.getRemoteEngineUuid();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getId", id);
    return id;
  }
1283088
public String generateSecureRandomId() {
        try {
            val random = new HexRandomStringGenerator(RANDOM_ID_SIZE);
            val hex = random.getNewString();
            if (StringUtils.isBlank(hex)) {
                throw new IllegalArgumentException("Could not generate a secure random id based on " + random.getAlgorithm());
            }
            return '_' + hex;
        } catch (final Exception e) {
            throw new IllegalStateException("Cannot create secure random ID generator for SAML message IDs.", e);
        }
    }
845891
private static String generateUniqueId(Set<String> ids, String idBase) {
		String id = idBase;
		int counter = 1;
		while (ids.contains(id)) {
			id = idBase + String.valueOf(counter++);
		}
		
		// put the newly generated one into the set
		ids.add(id);
		return id;
	}
785794
public String getRequestID() {
		if(requestID == null)
		{
		requestID = UUID.randomUUID().toString().replace("-", "");
		}
		return requestID;
	}
243764
private String getOrGenerateFailureId()
	{
		final HttpCallContext ctx = HttpCallContext.peek();

		if (ctx != null && ctx.getLogId() != null)
		{
			return ctx.getLogId();
		}
		else
		{
			// Generate a random UUID
			return UUID.randomUUID().toString();
		}
	}
1263022
public String getId() {
        Pattern replace = Pattern.compile("\\W+");
        return StringUtils.defaultIfEmpty(id, replace.matcher(getName()).replaceAll(""));
    }
478147
protected int getNextId(ServletRequest req)
    {
        Integer i = (Integer) RequestUtils.getOuterAttribute((HttpServletRequest) req,NETUI_UNIQUE_CNT);
        if (i == null) {
            i = new Integer(0);
        }

        int ret = i.intValue();
        RequestUtils.setOuterAttribute((HttpServletRequest) req,NETUI_UNIQUE_CNT, new Integer(ret + 1));
        return ret;
    }
1170544
public static String generateRequestId() {
        /* compute a random 256-bit string and hex-encode it */
        final SecureRandom sr = new SecureRandom();
        final byte[] bytes = new byte[32];
        sr.nextBytes(bytes);
        return hexEncode(bytes);
    }
714029
public synchronized QueryId createNextQueryId()
    {
        // only generate 100,000 ids per day
        if (counter > 99_999) {
            // wait for the second to rollover
            while (MILLISECONDS.toSeconds(nowInMillis()) == lastTimeInSeconds) {
                Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
            }
            counter = 0;
        }

        // if it has been a second since the last id was generated, generate a new timestamp
        long now = nowInMillis();
        if (MILLISECONDS.toSeconds(now) != lastTimeInSeconds) {
            // generate new timestamp
            lastTimeInSeconds = MILLISECONDS.toSeconds(now);
            lastTimestamp = TIMESTAMP_FORMAT.print(now);

            // if the day has rolled over, restart the counter
            if (MILLISECONDS.toDays(now) != lastTimeInDays) {
                lastTimeInDays = MILLISECONDS.toDays(now);
                counter = 0;
            }
        }

        return new QueryId(String.format("%s_%05d_%s", lastTimestamp, counter++, coordinatorId));
    }