
#include <cstdlib>
#include <string>
#include <iostream>

using namespace std;

struct Reference {
    int refnum;
    string text;
};


int main () {
    const int numRefs = 50;
    const int textlen = 1024*1024*4;
    Reference *refs = new Reference [numRefs];
    for (int i=0; i<numRefs; ++i) {
        refs [i].refnum = rand() % 1024;
        const int len = rand() % 20 + 5;
        for (int c=0; c<len; ++c)
            refs [i].text += static_cast <char> (rand()%26+'a');
    }
    
    for (int i=0; i<textlen; ++i) {
        const int wordLen = rand() % 40;
        for (int c=0; c<wordLen && i<textlen; ++i, ++c) {
            cout << static_cast <char> (rand()%26+'a');
        }
        cout << "[" << refs [rand()%numRefs].refnum << "]";
    }
    
    cout << "\n@footnote:\n";
    for (int i=0; i<numRefs; ++i) {
        const Reference &ref = refs [i];
        cout << "[" << ref.refnum << "] " << ref.text << "\n";
    }
    
    delete [] refs;
}
