# Monte Carlo Simulation In Python instead of HSPICE

Suppose I have a resistor and I want to simulate process variation on it.
When I was reading online, I noticed that Monte Carlo simulation is used for this purpose. I also noticed that HSPICE has this option.
However, I like to use Python for this purpose. I wanted to generated different resistance using Python random number generator (such as Gaussian distribution). I was wondering if these two methods (HSPICE or Python) are conceptually the same procedure.

## 2 Answers

As long as you can accurately simulate the effects of the resistance variation in Python, yes.

Monte Carlo simulation isn't a SPICE thing -- its a general simulation thing that tends to get used a lot in SPICE because it happens to be a good way of predicting whether a circuit board design will work in practice.

• thanks for your response. Yes, I understand what you mean. I am assuming a Gaussian distribution with specific mean and sigma (that matches some assumption for actual variation). Then, take sample from distribution. – Shabnam Nov 14 '18 at 20:17

Simulating one resistor is easy, but you're typically looking for the effect that variation has on a functional circuit. If you can describe the transfer function of the parameters you want to look at relative to the parameter(s) you want to vary, you can do it in any programming language. For something simple like this divider, it's not difficult to work out, but it's far easier to let the software work that out on a more complex circuit. (This one is in LTSpice, with Gaussian distributions used rather than the mc function that uses a flat distribution) 