# How to generate data that meets two requirments

#### manar

##### New Member
Hello

I am trying to generate a random set of data that should have a certain shape, lets say a normal distribution shape, where its maximum value = x and the total = y.

Basically, I am looking to generate data the represents the hourly energy consumption rate of a house and the sum of these data should equal to a certain monthly consumption value and the peak( max value) of these data should equal a certain value as well.

Any methods, concepts, software that can direct me to the solution ?

#### Miner

##### TS Contributor
This sounds like a Monte Carlo simulation, but you may have added some constraints that require linear programming.

You can do Monte Carlo in Excel using = NORM.INV(RAND(), mu, sigma), where mu = the mean hourly consumption. sigma would be the standard deviation of this hourly consumption. The apparent constraints would require the addition of Solver. I have used each individually, but never in combination, so I cannot guarantee success.

Using Monte Carlo alone would let you see what percentage would exceed each constraint, and you could tweak the parameters until you met the constraints.

#### Dragan

##### Super Moderator
Hello

I am trying to generate a random set of data that should have a certain shape, lets say a normal distribution shape, where its maximum value = x and the total = y.

Basically, I am looking to generate data the represents the hourly energy consumption rate of a house and the sum of these data should equal to a certain monthly consumption value and the peak( max value) of these data should equal a certain value as well.

Any methods, concepts, software that can direct me to the solution ?

Yes, it can be done through Monte Carlo Simulation techniques - but through "Brute Force."

Specifically, you would set your desired parameters - based on the distribution you are drawing from - and accept a solution that meets your criteria or reject otherwise and keep repeating the source code and collect up your desired number of solved data points. For example, it may take 10,000,000 iterations to get 25,000 desired data points.

You would need a fast algorithm based on a non-windows based program e.g. Fortran, C++, et al. for speed.

In short, it can be done.

#### manar

##### New Member
Thanks a lot guys, you helped me at least know where to look. Monte Carlo simulation seems helpful.