<commit_before>package com.backfield.imagegenerator;

import java.awt.image.BufferedImage;
import java.util.Random;

public class ImageDraw {

    private BufferedImage image;

    private int squareSize;
    private int numberOfSquares;

    private int x = 0;
    private int y = 0;

    private Random random = new Random();

    private final int baseColor = 0x313A75;

    private final int[] baseColorPalette = {0x182157, 0x080F3A, 0x525B92, 0x7C93AF};

    private final int compliment = 0xAA8A39;

    private final int[] complimentPalette = {0xFFE7AA, 0xD4B66A, 0x806115, 0x553D00};

    public ImageDraw(int squareSize, int numberOfSquares) {
        this.squareSize = squareSize;
        this.numberOfSquares = numberOfSquares;
        this.image = new BufferedImage(this.squareSize * this.numberOfSquares, this.squareSize * this.numberOfSquares, BufferedImage.TYPE_INT_RGB);
    }

    public void setSeed(int hash) {
        this.random.setSeed(hash);
    }

    private void drawLowerLeftTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = squareX; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawLowerRightTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = (this.squareSize - squareX); squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawUpperLeftTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = 0; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawUpperRightTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = 0; squareY < squareX; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawSquare() {
        int color = this.nextColor();
        for(int squareX = 0; squareX < this.squareSize; squareX++) {
            for(int squareY = 0; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private int nextColor() {
        float rand = this.random.nextFloat();
        int base;
        int[] palette;
        if(rand < 0.1) {
            base = compliment;
            palette = complimentPalette;
        } else {
            base = baseColor;
            palette = baseColorPalette;
        }
        if(rand < 0.6) {
            return base;
        } else {
            return palette[(int)(rand * 4)];
        }
    }

    public BufferedImage draw() {
        for(this.x = 0; this.x < this.numberOfSquares; this.x++) {
            for(this.y = 0; this.y < this.numberOfSquares; this.y++) {
                float rand = this.random.nextFloat();
                if(rand < 0.2) {
                    this.drawSquare();
                } else if(rand < 0.4) {
                    this.drawUpperRightTriangle();
                } else if(rand < 0.6) {
                    this.drawUpperLeftTriangle();
                } else if(rand < 0.8) {
                    this.drawLowerRightTriangle();
                } else {
                    this.drawLowerLeftTriangle();
                }
            }
        }
        return this.image;
    }

}
<commit_msg>Changed from nextFloat to nextInt() which will work better.<commit_after>package com.backfield.imagegenerator;

import java.awt.image.BufferedImage;
import java.util.Random;

public class ImageDraw {

    private BufferedImage image;

    private int squareSize;
    private int numberOfSquares;

    private int x = 0;
    private int y = 0;

    private Random random = new Random();

    private final int baseColor = 0x313A75;

    private final int[] baseColorPalette = {0x182157, 0x080F3A, 0x525B92, 0x7C93AF};

    private final int compliment = 0xAA8A39;

    private final int[] complimentPalette = {0xFFE7AA, 0xD4B66A, 0x806115, 0x553D00};

    public ImageDraw(int squareSize, int numberOfSquares) {
        this.squareSize = squareSize;
        this.numberOfSquares = numberOfSquares;
        this.image = new BufferedImage(this.squareSize * this.numberOfSquares, this.squareSize * this.numberOfSquares, BufferedImage.TYPE_INT_RGB);
    }

    public void setSeed(int hash) {
        this.random.setSeed(hash);
    }

    private void drawLowerLeftTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = squareX; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawLowerRightTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = (this.squareSize - squareX); squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawUpperLeftTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = 0; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawUpperRightTriangle() {
        int color = this.nextColor();
        for (int squareX = 0; squareX < this.squareSize; squareX++) {
            for (int squareY = 0; squareY < squareX; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private void drawSquare() {
        int color = this.nextColor();
        for(int squareX = 0; squareX < this.squareSize; squareX++) {
            for(int squareY = 0; squareY < this.squareSize; squareY++) {
                this.image.setRGB(this.x * this.squareSize + squareX, this.y * this.squareSize + squareY, color);
            }
        }
    }

    private int nextColor() {
        float rand = this.random.nextFloat();
        int base;
        int[] palette;
        if(rand < 0.1) {
            base = compliment;
            palette = complimentPalette;
        } else {
            base = baseColor;
            palette = baseColorPalette;
        }
        if(rand < 0.6) {
            return base;
        } else {
            return palette[(int)(rand * 4)];
        }
    }

    public BufferedImage draw() {
        for(this.x = 0; this.x < this.numberOfSquares; this.x++) {
            for(this.y = 0; this.y < this.numberOfSquares; this.y++) {
                switch(this.random.nextInt(5)) {
                    case 0:
                        this.drawSquare();
                        break;
                    case 1:
                        this.drawUpperRightTriangle();
                        break;
                    case 2:
                        this.drawUpperLeftTriangle();
                        break;
                    case 3:
                        this.drawLowerRightTriangle();
                        break;
                    case 4:
                        this.drawLowerLeftTriangle();
                        break;
                }
            }
        }
        return this.image;
    }

}

{'fraction_non_alphanumeric': 0.10795315930714809, 'fraction_numerical': 0.018297145645279338, 'mean_word_length': 1.7982935153583617, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 3, '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': '4667173', 'n_tokens_mistral': 2554, 'n_tokens_neox': 2359, 'n_words': 561}