lundi 13 juillet 2020

Generate two series of random numbers with condition

How to generate 1000 sets consisting of 5 random numbers each (buy and sell prices) with the following requirements:

Prices do not have dependencies between sets only within a set. Prices should be positive numbers with 2 decimal places. E.g. drawn from a normal distribution with mean 40 and sd 4

Example

set_id 1

buy_prices: 23, 22, 21, 20, 19 -> buy prices should be sorted in desc order 
sell_prices: 24, 25, 26, 27, 28 -> sell prices should be sorted in ascending order 

Conditions:
buy prices: 1st > 2nd > 3rd > 4th > 5th
sell prices: 1st < 2nd < 3rd < 4th < 5th
In each set the first buy price should be < first sell_price



Aucun commentaire:

Enregistrer un commentaire