Files
InvokeAI/invokeai/frontend/web/src/common/util/generateSeeds.ts
psychedelicious b661d93bd8 tidy(ui): clean up unused code 4
variables, types and schemas
2024-03-01 10:42:33 +11:00

19 lines
482 B
TypeScript

import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants';
import { random } from 'lodash-es';
type GenerateSeedsArg = {
count: number;
start?: number;
min?: number;
max?: number;
};
export const generateSeeds = ({ count, start, min = NUMPY_RAND_MIN, max = NUMPY_RAND_MAX }: GenerateSeedsArg) => {
const first = start ?? random(min, max);
const seeds: number[] = [];
for (let i = first; i < first + count; i++) {
seeds.push(i % max);
}
return seeds;
};