public void writeDataMap(String fileName, int nrecords, int setMod, int range, int seed, HashMap<String, String> binMap){
		File file = new File(fileName);
		// if file doesnt exists, then create it
		
		try {
			if (!file.exists()) {
				file.createNewFile();
			}
			Writer bw = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream(file), "UTF8"));
			Random r = new Random(seed);	
			int rint;
			for (int i = 0; i <= nrecords; i++) {
				int comma = 0;
				
				rint = r.nextInt(range);
			
				Iterator<Entry<String, String>> iterator = binMap.entrySet().iterator();
				String binName;
				String binType;
				Map.Entry<String, String> mapEntry;
				while (iterator.hasNext()) {
					mapEntry = iterator.next();
					binName = mapEntry.getKey();
					binType = mapEntry.getValue();
					if ( binName != null){
						if(i == 0) {
							bw.write(binName);
						} else {
							
							if(binName.equalsIgnoreCase("key")) {
								bw.write(getValue(binName, binType, i));					
							} else if(binName.equalsIgnoreCase("set")) {
								bw.write(getValue(binName, "string", i%setMod));	
							} else {
								bw.write(getValue(binName, binType, rint));
							}
					    }
					}
					if( binMap.size() > ++comma) {
						bw.write(String.format(","));
					}						
				}
				bw.write("\n");
			}
			bw.flush();
			bw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}