示例#1
0
    if '-Nexp' in sys.argv:
        p = sys.argv.index('-Nexp')
        Ne = int(sys.argv[p + 1])
        if Ne > 0:
            Nexp = Ne
    if '-output' in sys.argv:
        p = sys.argv.index('-output')
        OutputFileName = sys.argv[p + 1]
        doOutputFile = True

    #create p6 using the probability inputs
    p6 = 1 - (p1 + p2 + p3 + p4 + p5)
    #entering probabilities into list format
    prob_list = [p1, p2, p3, p4, p5, p6]

    # class instance of our Random class using seed
    random = Random(seed)

    if doOutputFile:
        outfile = open(OutputFileName, 'w')
        for e in range(0, Nexp):
            for t in range(0, Nroll):
                outfile.write(str(random.cate(prob_list)) + " ")
            outfile.write(" \n")
        outfile.close()
    else:
        for e in range(0, Nexp):
            for t in range(0, Nroll):
                print(random.cate(prob_list), end=' ')
            print(" ")