minor fixes
wip dialogue fixed
This commit is contained in:
@@ -17,17 +17,20 @@ def generateFile(rows, lenghtOfRows):
|
|||||||
content.append(generateRow(lenghtOfRows))
|
content.append(generateRow(lenghtOfRows))
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
||||||
def generateRow(lenghtOfRows):
|
def generateRow(lenghtOfRows):
|
||||||
row = ""
|
row = ""
|
||||||
for z in range(0, lenghtOfRows):
|
for z in range(0, lenghtOfRows):
|
||||||
row = row + str(randint(0, 9))
|
row = row + str(randint(0, 9))
|
||||||
return row
|
return row
|
||||||
|
|
||||||
|
|
||||||
def writeFile(content, x, o):
|
def writeFile(content, x, o):
|
||||||
file = open("testdata/file" + str(x+o) + ".txt", "w")
|
file = open("testdata/file" + str(x + o) + ".txt", "w")
|
||||||
for w in range(0, len(content)):
|
for w in range(0, len(content)):
|
||||||
file.write(content[w] + "\n")
|
file.write(content[w] + "\n")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("Hello World")
|
print("Hello World")
|
||||||
i = int(input("How many units would you like to generate? "))
|
i = int(input("How many units would you like to generate? "))
|
||||||
@@ -36,29 +39,33 @@ if __name__ == '__main__':
|
|||||||
c = int(input("How many threads do you want to use?"))
|
c = int(input("How many threads do you want to use?"))
|
||||||
print('preparing')
|
print('preparing')
|
||||||
counter = int(0)
|
counter = int(0)
|
||||||
div = i/c
|
div = i / c
|
||||||
|
|
||||||
while counter < c:
|
while counter < c:
|
||||||
o = div * counter
|
o = div * counter
|
||||||
print('thread ' + str(counter) + ' set to start at ' + str(o))
|
print('thread ' + str(counter) + ' set to start at ' + str(o))
|
||||||
globals()["p" + str(counter)] = multiprocessing.Process(target=main, args=(div, a, b, o))
|
globals()["p" + str(counter)] = multiprocessing.Process(target=main, args=(div, a, b, o))
|
||||||
counter = counter +1
|
counter = counter + 1
|
||||||
counter = int(0)
|
counter = int(0)
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
print('starting')
|
print('starting')
|
||||||
|
|
||||||
while counter < c:
|
while counter < c:
|
||||||
globals()["p" + str(counter)].start()
|
globals()["p" + str(counter)].start()
|
||||||
print('thread number ' +str(counter) + ' just started')
|
print('thread number ' + str(counter) + ' just started')
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
|
if counter == c: print(' ')
|
||||||
|
if counter == c: print('working, this might take a while')
|
||||||
|
|
||||||
counter = int(0)
|
counter = int(0)
|
||||||
|
|
||||||
while counter < c:
|
while counter < c:
|
||||||
globals()["p" + str(counter)].join()
|
globals()["p" + str(counter)].join()
|
||||||
print('thread number ' + str(counter) + ' just finished')
|
print('thread number ' + str(counter) + ' just finished')
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
print('working, this might take a while')
|
|
||||||
|
print(" ")
|
||||||
print("Data is generated. Have fun!")
|
print("Data is generated. Have fun!")
|
||||||
sec = time.time() - start_time
|
sec = time.time() - start_time
|
||||||
minutes = sec / 60
|
minutes = sec / 60
|
||||||
print("randomI took " + str(sec) + " seconds (" + str(minutes) + " minutes) for execution.")
|
print("randomI took " + str(sec) + " seconds (" + str(minutes) + " minutes) for execution.")
|
||||||
|
|||||||
Reference in New Issue
Block a user