#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 16 11:14:42 2021

@author: kevinmcbride
"""
#%%
# from multiprocessing import Process, Queue
# import random

# def rand_num():
    
#     num = random.random()
#     print(num)
    
# if __name__ == "__main__":
    
#     queue = Queue()
    
#     processes = [Process(target=rand_num, args=()) for x in range(4)]
    
#     for p in processes:
#         p.start()
        
#     for p in processes:
#         p.join()
        
        
#%%

import multiprocessing as mp

def my_func(x):
    print(mp.current_process())
    return x**x
    
def main():
    pool = mp.Pool(mp.cpu_count())
    result = pool.map(my_func, [4,2,3,5,3,2,1,2])
    result_set_2 = pool.map(my_func, [4,6,5,4,6,3,23,4,6])
    
    print(result)
    print(result_set_2)
    
    
if __name__ == '__main__':
    main()