feat:提交
This commit is contained in:
11
tests/dev1/dataHandle/common/Random.ts
Normal file
11
tests/dev1/dataHandle/common/Random.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user