MCPcopy
hub / github.com/simstudioai/sim / randomItem

Function randomItem

packages/utils/src/random.ts:75–78  ·  view source on GitHub ↗
(items: readonly T[])

Source from the content-addressed store, hash-verified

73 * @param items - Array to sample from (must have at least one element)
74 */
75export function randomItem<T>(items: readonly T[]): T {
76 if (items.length === 0) throw new RangeError('randomItem: array must not be empty')
77 return items[randomInt(0, items.length)]
78}

Callers 5

generateUserRowFunction · 0.90
getRandomWorkspaceColorFunction · 0.90
generateWorkspaceNameFunction · 0.90
generateUniqueTableNameFunction · 0.90

Calls 1

randomIntFunction · 0.85

Tested by

no test coverage detected