jeudi 4 novembre 2021

Generate List of random Floats in a sequence for Mocking IoT Sensor

I have been struggling to mock the IoT Sensor data. I need a list of floats which will increase and decrease sequentially. For example [0.1, 0.12, 0.13, 0.18, 1.0, 1.2, 1.0, 0.9, 0.6] Right now I have generated the list with max and min range using this,

for k in dts:
    x = round(random.uniform(j["min"], j["max"]), 3)
    random_float_list.append(x)

list generated form this code is not in a sequence. I need something which generates random floats in range and there are no abrupt changes in it. Values can increase and decrease in a sequence.




Aucun commentaire:

Enregistrer un commentaire