Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import crypto from 'crypto'2 3import { urlAlphabet } from './url-alphabet/index.js'4 5const POOL_SIZE_MULTIPLIER = 1286let pool, poolOffset7 8let fillPool = bytes => {9 if (bytes < 0) throw new RangeError('Wrong ID size')10 try {11 if (!pool || pool.length < bytes) {12 pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)13 crypto.randomFillSync(pool)14 poolOffset = 015 } else if (poolOffset + bytes > pool.length) {16 crypto.randomFillSync(pool)17 poolOffset = 018 }19 } catch (e) {20 pool = undefined21 throw e22 }23 poolOffset += bytes24}25 26let random = bytes => {27 fillPool((bytes |= 0))28 return pool.subarray(poolOffset - bytes, poolOffset)29}30 31let customRandom = (alphabet, defaultSize, getRandom) => {32 let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 133 34 35 let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)36 37 return (size = defaultSize) => {38 if (size <= 0) return ''39 let id = ''40 while (true) {41 let bytes = getRandom(step)42 let i = step43 while (i--) {44 id += alphabet[bytes[i] & mask] || ''45 if (id.length === size) return id46 }47 }48 }49}50 51let customAlphabet = (alphabet, size = 21) =>52 customRandom(alphabet, size, random)53 54let nanoid = (size = 21) => {55 fillPool((size |= 0))56 let id = ''57 for (let i = poolOffset - size; i < poolOffset; i++) {58 id += urlAlphabet[pool[i] & 63]59 }60 return id61}62 63export { nanoid, customAlphabet, customRandom, urlAlphabet, random }64 