tscircuit/autorouting-dataset-01
This code manages the hardware and electronic components for circuit design and PCB layout, defining components like resistors, capacitors, transistors, connectors, and footprints, and providing tools for component placement, PCB topology, and electrical connections.
- Version
- 1.0.102
- License
- unset
- Stars
- 4
lib/maths/random/pick.ts
import { randInt } from "lib/maths/random/randInt"
/**
* Randomly picks an item from a list.
*/
export const pick = <T>(options: {
items: readonly T[]
rng: () => number
}): T => {
const { items, rng } = options
return items[randInt({ min: 0, max: items.length, rng })]
}