import time import numpy as np from numpy import random import hashlib # Programa que produz um sinal espaçado aleatóriamente # A função time.time() tem output em seconds since the epoch # Epoch pode ser checada com time.gmtime(0) # para UNIX é January 1, 1970, 00:00:00 (UTC) opcoes_local= ('POA','EU','EUA') opcoes_usuario= ('bruno','maria','joao','timot') USUA= random.choice(opcoes_usuario) #escolhe um valor aleatório das opcoes_local LOCA= random.choice(opcoes_local) tempo_espera = abs(np.log(1.0 - np.random.random())) HORA= time.time()*1000 #ms INTE= np.random.normal(20, 5) #Unidade: V TEMP= np.random.normal(20, 0.1) #°C UMID= np.random.normal(80, 0.5) #% PRES= np.random.normal(1017, 0.4) #hPa string = str(HORA)+str(LOCA)+str(INTE)+str(TEMP)+str(UMID)+str(PRES)+USUA result = hashlib.md5(string.encode()) HASH = result.hexdigest() time.sleep(tempo_espera) mensagem= str(HORA)+" "+str(LOCA)+" "+str(INTE)+" "+str(TEMP)+" "+str(UMID)+" "+str(PRES)+" "+str(USUA)+" "+str(HASH) print (mensagem)