File size: 482 Bytes
8a37e0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
};