<commit_before>#include "heightmap/heightmapgenerator.hpp"

#include <ctime>

HeightmapGenerator::HeightmapGenerator(int size, int seed, int variation) {
	mapWidth = size;
	HeightmapGenerator::variation = variation;
	vertices = new HMVertex[size*size];
	vertexCount = 0;
	
	for(int i = 0; i < size; ++i) {
		IntVectorPtr intVectorPtr(new std::vector<int>(size));
		map.push_back(intVectorPtr);
	}

	(*map[0])[0] = seed;
	(*map[0])[size-1] = seed;
	(*map[size-1])[0] = seed;
	(*map[size-1])[size-1] = seed;
}

HeightmapGenerator::~HeightmapGenerator() {
}

const Matrix& HeightmapGenerator::getMap() {
	return map;
}

HMVertex* HeightmapGenerator::getVertices() {
	return vertices;
}

void HeightmapGenerator::fillMap() {
	srand(std::time(0));
	int twoLog = numberOfTrailingZeros(map.size()-1);<commit_msg>Fixed heightmapgenerator, now correctly allocates memory<commit_after>#include "heightmap/heightmapgenerator.hpp"

#include <ctime>

HeightmapGenerator::HeightmapGenerator(int size, int seed, int variation) {
	HeightmapGenerator::variation = variation;
	vertexCount = 0;
	
	for(int i = 0; i < size; ++i) {
		IntVectorPtr intVectorPtr(new std::vector<int>(size));
		map.push_back(intVectorPtr);
	}

	(*map[0])[0] = seed;
	(*map[0])[size-1] = seed;
	(*map[size-1])[0] = seed;
	(*map[size-1])[size-1] = seed;

	mapWidth = size;
	int pow = numberOfTrailingZeros(size-1);
	int arraySize = ((1 << (pow+1))-1)*mapWidth+2;
	vertices = new HMVertex[arraySize];
}

HeightmapGenerator::~HeightmapGenerator() {
}

const Matrix& HeightmapGenerator::getMap() {
	return map;
}

HMVertex* HeightmapGenerator::getVertices() {
	return vertices;
}

void HeightmapGenerator::fillMap() {
	srand(std::time(0));
	int twoLog = numberOfTrailingZeros(map.size()-1);
{'fraction_non_alphanumeric': 0.169151376146789, 'fraction_numerical': 0.016628440366972478, 'mean_word_length': 6.240663900414938, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '5984574', 'n_tokens_mistral': 660, 'n_tokens_neox': 636, 'n_words': 117}