<commit_before>package com.kushkipagos.commons;

import com.kushkipagos.Amount;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang3.RandomUtils.nextInt;

/**
 * Created by lmunda on 12/16/15 10:22.
 */
public final class TestsHelpers {

    private TestsHelpers() {

    }

    public static Double getRandomDouble(Double min, Double max) {
        Random r = new Random();
        return min + (max - min) * r.nextDouble();
    }

    public static Double getRandomAmount(boolean valid) {
        double[] validCents = {0.0, 0.08, 0.11, 0.59, 0.6};
        double[] invalidCents = {0.05, 0.1, 0.21, 0.61, 0.62, 0.63};

        double cents;
        if (valid) {
            int centPosition = nextInt(0, validCents.length - 1);
            cents = validCents[centPosition];
        } else {
            int centPosition = nextInt(0, invalidCents.length - 1);
            cents = invalidCents[centPosition];
        }
        return nextInt(1, 9999) + cents;
    }

    public static Amount getRandomAmount() {
        return new Amount(1d, 1d, 1d, 1d, 1d);
    }

    public static Double getRandomDoubleAmount() {
        return getRandomAmount(true);
    }

    public static Integer getRandomMonths() {
        return nextInt(1, 13);
    }

    public static Map<String, String> getValidCardData() {
        Map<String, String> cardParams = new HashMap<>(5);
        cardParams.put("name", randomAlphabetic(20));
        cardParams.put("number", "4017779991118888");
        cardParams.put("expiry_month", "12");
        cardParams.put("expiry_year", "21");
        cardParams.put("cvv", "123");
        return cardParams;<commit_msg>[KFE-000] Changing getRandomMonthsmethod  to return valid months<commit_after>package com.kushkipagos.commons;

import com.kushkipagos.Amount;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang3.RandomUtils.nextInt;

/**
 * Created by lmunda on 12/16/15 10:22.
 */
public final class TestsHelpers {

    private TestsHelpers() {

    }

    public static Double getRandomDouble(Double min, Double max) {
        Random r = new Random();
        return min + (max - min) * r.nextDouble();
    }

    public static Double getRandomAmount(boolean valid) {
        double[] validCents = {0.0, 0.08, 0.11, 0.59, 0.6};
        double[] invalidCents = {0.05, 0.1, 0.21, 0.61, 0.62, 0.63};

        double cents;
        if (valid) {
            int centPosition = nextInt(0, validCents.length - 1);
            cents = validCents[centPosition];
        } else {
            int centPosition = nextInt(0, invalidCents.length - 1);
            cents = invalidCents[centPosition];
        }
        return nextInt(1, 9999) + cents;
    }

    public static Amount getRandomAmount() {
        return new Amount(1d, 1d, 1d, 1d, 1d);
    }

    public static Double getRandomDoubleAmount() {
        return getRandomAmount(true);
    }

    public static Integer getRandomMonths() {
        int[] monthsDeferred = {3, 6, 9, 12};
        int rnd = new Random().nextInt(monthsDeferred.length);
        return monthsDeferred[rnd];
    }

    public static Map<String, String> getValidCardData() {
        Map<String, String> cardParams = new HashMap<>(5);
        cardParams.put("name", randomAlphabetic(20));
        cardParams.put("number", "4017779991118888");
        cardParams.put("expiry_month", "12");
        cardParams.put("expiry_year", "21");
        cardParams.put("cvv", "123");
        return cardParams;
{'fraction_non_alphanumeric': 0.12355316285329744, 'fraction_numerical': 0.047106325706594884, 'mean_word_length': 2.716, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2556698', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1153, 'n_words': 280}