Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocessing import Process
- import random
- import math
- def bubble_sort(array):
- check = True
- while check == True:
- check = False
- for i in range(0, len(array)-1):
- if array[i] > array[i+1]:
- check = True
- temp = array[i]
- array[i] = array[i+1]
- array[i+1] = temp
- print("Array sorted: ", array)
- def rand_array():
- arrayofrand = list()
- for a in range(20):
- #random.seed(a)
- arrayofrand.append(math.floor(random.random() *1000))
- #print (arrayofrand)
- return arrayofrand
- if __name__ == '__main__':
- p = Process(target=bubble_sort, args=(rand_array(),))
- p.start()
- p.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement