CharacterReference[] list;
StringBuffer stimulus;
StringBuffer response;
char character;
int index;
CharacterReference ref;
String kernel;
ArrayList forbidden;
String string;
random = new Random ();
list = getReferences ();
stimulus = new StringBuffer ();
response = new StringBuffer ();
for (int i = 0; i < 1000; i++)
{
for (int j = 0; j < 10; j++)
{
// some random characters
for (int k = 0; k < 10; k++)
{
character = (char)random.nextInt (127);
if (character >= ' ')
{
if ('&' == character)
{
stimulus.append (character);
response.append ("&");
}
else if ('"' == character)
{
stimulus.append (character);
response.append (""");
}
else if ('<' == character)
{
stimulus.append (character);
response.append ("<");
}
else if ('>' == character)
{
stimulus.append (character);
response.append (">");
}
else
{
stimulus.append (character);
response.append (character);
}
}
}
index = random.nextInt (list.length);
ref = list[index];
kernel = ref.getKernel ();
stimulus.append ((char)ref.getCharacter ());
response.append ("&");
response.append (kernel);
// to be fair, we ensure that the next character isn't valid
// for a different reference, i.e. &sup shouldn't be followed
// by a 1, 2, 3 or e