I'm trying to make a program that asks me random words' translations based on a custom dictionary (an XML file). An XML entry consists of "English", "Spanish", "Appearance" and "CorrectGuesses" sections.
I created a class called "Word" and the class holds the words' translations and the ratios representing how much I know those words. The simplified version of the code:
class Word
{
public string english;
public string spanish;
private int appearance;
private int correctGuesses;
private float ratio;
// The constructor takes the translation and the numbers, and calculates the ratio
public Word(...
public void Appeared(bool guessedCorrectly)
{
if (guessedCorrectly)
{
++correctGuesses;
}
++appearance;
ratio = (float)correctGuesses / appearance;
}
}
I want to select a random word depending on the ratios of the all words, which means selecting randomly between the words that have low ratios. So, I can focus on the words that I know less. Is there any algorithm I can use for my need? Or what kind of logic should I make and which data type should I use?