<commit_before>/// <reference path="../../index.d.ts" />

import RandExp from 'randexp';

import * as data from './dummy-data';
import { DEFAULT_TELEPHONE_TEMPLATE, SanitizeText } from './helpers';

class DataGenerator {
  private options: IFormFillerOptions;
  private previousUsername: string;
  private previousFirstName: string;
  private previousLastName: string;

  constructor(options: IFormFillerOptions) {
    this.options = options;
    this.previousUsername = '';
    this.previousFirstName = '';
    this.previousLastName = '';
  }

  public setPreviousUsername(username: string): void {
    this.previousUsername = username;
  }

  public setPreviousFirstName(firstName: string): void {
    this.previousFirstName = firstName;
  }

  public setPreviousLastName(lastName: string): void {
    this.previousLastName = lastName;
  }

  public randomNumber(start: number, end: number): number {
    return Math.floor(Math.random() * (end - start + 1) + start);
  }

  public scrambledWord(minLength: number = 3, maxLength: number = 15): string {
    const wordLength = this.randomNumber(minLength, maxLength);
    let resultWord = '';
    let odd = true;

    while (resultWord.length < wordLength) {<commit_msg>modify randomNumber to return number with optional decimalPlaces (default 0)<commit_after>/// <reference path="../../index.d.ts" />

import RandExp from 'randexp';

import * as data from './dummy-data';
import { DEFAULT_TELEPHONE_TEMPLATE, SanitizeText } from './helpers';

class DataGenerator {
  private options: IFormFillerOptions;
  private previousUsername: string;
  private previousFirstName: string;
  private previousLastName: string;

  constructor(options: IFormFillerOptions) {
    this.options = options;
    this.previousUsername = '';
    this.previousFirstName = '';
    this.previousLastName = '';
  }

  public setPreviousUsername(username: string): void {
    this.previousUsername = username;
  }

  public setPreviousFirstName(firstName: string): void {
    this.previousFirstName = firstName;
  }

  public setPreviousLastName(lastName: string): void {
    this.previousLastName = lastName;
  }

  public randomNumber(start: number, end: number, decimalPlaces: number = 0): number {
    const result: number = Math.random() * (end - start + 1) + start;
    return Number(result.toFixed(decimalPlaces));
  }

  public scrambledWord(minLength: number = 3, maxLength: number = 15): string {
    const wordLength = this.randomNumber(minLength, maxLength);
    let resultWord = '';
    let odd = true;

    while (resultWord.length < wordLength) {
{'fraction_non_alphanumeric': 0.1153250773993808, 'fraction_numerical': 0.003869969040247678, 'mean_word_length': 4.09861932938856, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '95863', 'n_tokens_mistral': 761, 'n_tokens_neox': 735, 'n_words': 192}