def printMcmcSamplesToFile(self, profile, numSamples, outFileName):
        """
        Generate samples to a file.

        :ivar Profile profile: A Profile object that represents an election profile.
        :ivar int numSamples: The number of samples to be generated.
        :ivar str outFileName: The name of the file to be output.
        """

        wmg = profile.getWmg(True)
        V = self.getInitialSample(wmg)

        # Print the number of candidates, phi, and the number of samples.
        outFile = open(outFileName, 'w')
        outFile.write("m," + str(profile.numCands) + '\n')
        outFile.write("phi," + str(self.phi) + '\n')
        outFile.write("numSamples," + str(numSamples))
        
        for i in range(0, numSamples):
            V = self.sampleGenerator.getNextSample(V)
            outFile.write("\n" + json.dumps(V))
        outFile.close()
Generate samples to a file.

        :ivar Profile profile: A Profile object that represents an election profile.
        :ivar int numSamples: The number of samples to be generated.
        :ivar str outFileName: The name of the file to be output.