import { paragraph, sentence } from '@/mocks/sentences/generateText' import { adjectives, nouns } from '@/mocks/sentences/sample' import { generateStarName } from '@/mocks/starnames' import { MockFunction } from '@/services/Mocker' import { choice } from '@/utilities/arrays' import { uniform } from '@/utilities/math' const characters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] as const export const randomChar: MockFunction = function() { return characters[Math.floor(Math.random() * characters.length)] } export const randomNoun: MockFunction = function() { return choice(nouns) } export const randomAdjective: MockFunction = function() { return choice(adjectives) } export const randomString: MockFunction = function(chars) { if (!chars) { chars = this.create('number', [5, 10]) } return new Array(chars).fill(null).map(() => this.create('char')).join('') } export const randomSentence: MockFunction = function() { return sentence() } export const randomParagraph: MockFunction = function(sentences) { return paragraph(sentences ? sentences : uniform(2, 5)) } export const randomRunName: MockFunction = function() { return generateStarName() }