MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / random_base62

Function random_base62

crates/opencode-core/src/id.rs:38–46  ·  view source on GitHub ↗
(length: usize)

Source from the content-addressed store, hash-verified

36static COUNTER: Mutex<u32> = Mutex::new(0);
37
38fn random_base62(length: usize) -> String {
39 let mut rng = rand::thread_rng();
40 let mut result = String::with_capacity(length);
41 for _ in 0..length {
42 let idx = rng.gen_range(0..62);
43 result.push(BASE62_CHARS[idx] as char);
44 }
45 result
46}
47
48fn get_counter() -> u32 {
49 let mut counter = COUNTER.lock().unwrap();

Callers 1

createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected