Constructs a random filename with the given prefix and
a random part generated from hex characters.

@param prefix
the prefix to the filename to be constructed
@return the generated random filename with the given prefix
10049
public static String getRandomFilename(final String prefix) {
		final Random rnd = new Random();
		final StringBuilder stringBuilder = new StringBuilder(prefix);

		for (int i = 0; i < RANDOM_FILE_NAME_LENGTH; i++) {
			stringBuilder.append(ALPHABET[rnd.nextInt(ALPHABET.length)]);
		}

		return stringBuilder.toString();
	}
249311
public static function randomNumberUsingRandomInt($prefix = '4', $length = 8)
    {
        $max = (int)str_pad("9", $length - strlen($prefix), "9");
        return $prefix . (string)str_pad(random_int(0, $max), $length - strlen($prefix), "0", STR_PAD_LEFT);
    }
1243023
public synchronized String getNamespaceURIByPrefix(String prefix) throws NamespaceException
   {
      if (!prefixToURI.containsKey(prefix))
      {
         throw new NamespaceException(prefix + ": is not a registered namespace prefix.");
      }
      return prefixToURI.get(prefix);
   }
413108
public static String createRandomName(String prefix) {
		Preconditions.checkNotNull(prefix, "Prefix must not be null.");

		long nameOffset;

		// obtain the next name offset by incrementing it atomically
		do {
			nameOffset = nextNameOffset.get();
		} while (!nextNameOffset.compareAndSet(nameOffset, nameOffset + 1L));

		return prefix + '_' + nameOffset;
	}
1008435
public static SuggestedFix prefixWith(Tree node, String prefix) {
    return builder().prefixWith(node, prefix).build();
  }
1285904
public static String constructFileName(String filenamePrefix, String extension, long recordCount) {
    Preconditions.checkArgument(
        filenamePrefix.equals(M_OUTPUT_FILE_PREFIX) || filenamePrefix.equals(MR_OUTPUT_FILE_PREFIX),
        String.format("%s is not a supported prefix, which should be %s, or %s.", filenamePrefix, M_OUTPUT_FILE_PREFIX,
            MR_OUTPUT_FILE_PREFIX));
    StringBuilder sb = new StringBuilder();
    sb.append(filenamePrefix);
    sb.append(Long.toString(recordCount));
    sb.append(SEPARATOR);
    sb.append(Long.toString(System.currentTimeMillis()));
    sb.append(SEPARATOR);
    sb.append(Integer.toString(RANDOM.nextInt(Integer.MAX_VALUE)));
    sb.append(extension);
    return sb.toString();
  }
1022676
private static final String randomString(final Random random) {
		final byte[] bytes = new byte[RANDOM_BYTES_LENGTH];
		random.nextBytes(bytes);
		return StringUtils.byteToHexString(bytes);
	}
106946
public final String getPrefix() {
		if ((prefix == null || prefix.isEmpty()) && (configuration != null)) {
			prefix = configuration.getPrefix();
		}
		return prefix;
	}
595972
public static Path createTempFolder(String prefix) throws IOException {
		Path parent = Paths.get(System.getProperty("java.io.tmpdir"));
		if (!Files.isDirectory(parent)) {
			throw new IOException("java.io.tmpdir points to a non-existing folder: " + parent);
		}
		Path ret = null;
		int i = 0;
		do {
			ret = parent.resolve(Objects.requireNonNull(prefix)+Long.toHexString(System.currentTimeMillis())+"-"+Integer.toHexString(RND.nextInt()));
			i++;
			if (i>=100) {
				throw new IOException("Failed to create temporary folder.");
			}
		} while (!ret.toFile().mkdirs());
		return ret;
	}
140057
public String randomName(String prefix, int maxLen) {
        prefix = prefix.toLowerCase();
        int minRandomnessLength = 5;
        if (maxLen <= minRandomnessLength) {
            return randomString(maxLen);
        }

        if (maxLen < prefix.length() + minRandomnessLength) {
            return randomString(maxLen);
        }

        String minRandomString = String.format("%05d", Math.abs(RANDOM.nextInt() % 100000));

        if (maxLen <= prefix.length() + randName.length() + minRandomnessLength) {
            String str = prefix + minRandomString;
            return str + randomString((maxLen - str.length()) / 2);
        }

        String str = prefix + randName + minRandomString;
        return str + randomString((maxLen - str.length()) / 2);
    }
1373207
public File createTempDir(String prefix, String suffix) {
    try {
      // Create a tempfile, and delete it.
      File file = File.createTempFile(prefix, suffix, baseDir);
      file.delete();

      // Create it as a directory.
      File dir = new File(file.getAbsolutePath());
      if (!dir.mkdirs()) {
        throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
      }

      // Create the directory and mark it writable.
      FileHandler.createDir(dir);

      temporaryFiles.add(dir);
      return dir;
    } catch (IOException e) {
      throw new WebDriverException(
          "Unable to create temporary file at " + baseDir.getAbsolutePath());
    }
  }
971694
private String noprefix(String name, String... prefix) {
        for (int i = 0; i < prefix.length; i++) {
            if (name.startsWith(prefix[i])) {
                name = name.replaceAll(prefix[i], "");
            }
        }
        return name;
    }
1140018
public void setDefaultPrefix(final String prefix) {
		lock.writeLock().lock();
		try {
			final String myPrefix = checkAndConvertPrefix(prefix);
			final List<String> prefixList = split(myPrefix);
			setDefaultPrefixes(prefixList);
		} finally {
			lock.writeLock().unlock();
		}
	}
858530
public static FileChannel createTempFile(String prefix, String suffix) throws IOException {
        return createTempFile(TMPDIR, prefix, suffix);
    }
357717
public static File [] getFilesWithPrefix(File dir, final String prefix) {
        FileFilter prefixFilter = new FileFilter() {
                public boolean accept(File pathname)
                {
                    return pathname.getName().toLowerCase().
                        startsWith(prefix.toLowerCase());
                }
            };
        return dir.listFiles(prefixFilter);
    }
1264039
public File createFileSync(String prefix, String suffix) throws IOException {
		File tmp;
		if (tempDir == null)
			tmp = File.createTempFile(this.prefix + prefix, suffix);
		else
			tmp = File.createTempFile(this.prefix + prefix, suffix, tempDir);
		tmp.deleteOnExit();
		return tmp;
	}
68106
def prefix(filename):
    '''  '''
    return os.path.split(re.sub(_afni_suffix_regex,"",str(filename)))[1]