first commit

This commit is contained in:
murdle
2026-03-01 02:38:58 +02:00
commit 19250b9db4
19111 changed files with 4358159 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#pragma once
// 4J - this WeighedRandomItem class was a nested static class within WeighedRandom, but we need to be able to refer to it externally
class WeighedRandomItem
{
friend class WeighedRandom;
protected:
int randomWeight;
public:
WeighedRandomItem(int randomWeight)
{
this->randomWeight = randomWeight;
}
};
class WeighedRandom
{
public:
// 4J - vectors here were Collection<? extends WeighedRandomItem>
static int getTotalWeight(vector<WeighedRandomItem *> *items);
static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items, int totalWeight);
static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items);
static int getTotalWeight(WeighedRandomItemArray items);
static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items, int totalWeight);
static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items);
};