Files
cut-abstractions/tests/dev1/dataHandle/common/Random.ts

12 lines
272 B
TypeScript
Raw Normal View History

2025-07-22 18:22:31 +08:00
import { FixIndex } from './Util'
export function RandomIndex(count: number, exclude?: number): number
{
let index = Math.floor(Math.random() * count)
if (index === count)
index = 0
if (index === exclude)
index = FixIndex(index + 1, count)
return index
}