public  void generateDatabase(int sequenceCount, int maxDistinctItems, int itemCountByItemset,
			int itemsetCountBySequence, String output, boolean withTimestamps) throws IOException {
		
		// We create a BufferedWriter to write the database to disk
		BufferedWriter writer = new BufferedWriter(new FileWriter(output)); 
		
		// For the number of sequences to be generated
		for (int i = 0; i < sequenceCount; i++) {
			// if it is not the first one, we write on a new line
			if(i != 0){
				writer.newLine();
			}
			// for the number of itemsets to be generated
			for (int j = 0; j < itemsetCountBySequence; j++) {
				// This hashset will be used to remember which items have
				// already been added to this itemset.
				HashSet<Integer> alreadyAdded = new HashSet<Integer>();
				
				// if the user asked for timestamps, we write the timestamp
				if(withTimestamps){
					writer.write("<" + j + "> ");
				}
				
				// create an arraylist to store items from the itemset that will be generated
				List<Integer> itemset = new ArrayList<Integer>();
				// for the number of items by itemset
				for (int k = 0; k < itemCountByItemset; k++) {
					// we generate the item randomly and write it to disk
					int item = random.nextInt(maxDistinctItems) + 1;
					// if we already added this item to this itemset
					// we choose another one
					while(alreadyAdded.contains(item)){
						item = random.nextInt(maxDistinctItems) + 1;
					}
					alreadyAdded.add(item);
					itemset.add(item);
				}
				// sort the itemset
				Collections.sort(itemset);
				// write the itemset
				for(Integer item : itemset){
					writer.write(item + " ");
				}
				
				// we write the itemset separator
				writer.write("-1 ");
			}
			// we write the end of line
			writer.write("-2 ");
		}
		writer.close(); // we close the file
	}