How can I wire blinking leds so that they can blink randomly ,giving that twinkling look?

I know where to get blinking flashing leds, but i dont know how to wire them. Im trying to get that sparkly/twinkle effect like those Christmas ads in stores

I think the answer depends on how many LEDs you want to drive in this manner.

If you just want to drive a handful of LEDs this way, say less than 5 LEDs,  I think that will be easier than trying to drive a large string, of say 30 to 100 of them.

Actually let me first address some easy, off-the-shelf, solutions that you can probably just buy, for less work-money than would be involved in building one.

LED candles
These produce sort of a slow, time-varying, "twinkling" kind of  light.  At the time of this writing LED candles can be found in packages of 2 or 3 for a price of 1 USD, at stores like this:
That store is a popular chain in the Former US, so if you also live in the FUS, there is probably a DollarTree(r) in or near the town you live in.
The main advantage of these LED candles is they are cheap.   If desired, you could wire up some large number of them, in parallel, and power them with something other than the coin cells they come with.

Twinkling LED Fairy Lights
If you want a big string of like, 100 or so, twinkling lights, I think this might be a good solution:
and that link is to one of the Hong Kong retailers on eBay.  I actually bought one of those, and it has a single button, for selecting 1 of 8 different modes of blinking.

On the little controller box itself, these are described as, "1) Combination; 2) In Waves; 3) Sequential; 4) Slo Glo;
5)Chasing/Flash; 6) Slow Fade; 7)Twinkle Flash; and 8) Steady On"

DIY Methods

Building your own flickering LEDs will take more work.  I can think of, broadly, two different ways to do this:  Analog and Digital via microcontroller.

If you like microcontrollers, e.g. Arduino(r), then you should probably just look up some script or sketch someone else has written to do this.

For the analog approach I suggest wiring up a NPN transistor as a voltage-to-current converter, by connecting the emitter of the transistor through a resistor R to ground.  Then the LED, or a series string of LEDs, gets connected between the collector of the transistor and Vcc.

Then you put the control signal, the source of "flicker", as a voltage on the base of the transistor, and the current through the LEDs is approximately,
I = (Vbase - O.6V)/R

But what do you use for the flickering control signal?  One answer to that is an audio signal, like canned music. 

Coincidentally, that is often what the makers of the LED candles use: cheap little music/melody ICs.  For example, this instructable,
shows a method for actually listening to the flickering signal in those LED candles.

Anyway, I am guessing that probably the easiest/best method, for what you have in mind, is to just go out and buy LEDs that flicker, because they're out there, via the sources I linked to above, and others.

The analog circuit I described kind of quickly. So if you are actually interested in that one, reply saying you want to know more about that,  and I'll draw you a picture(circuit diagram) of it. BTW,  that trick is probably only good for driving maybe 2 or 3 LEDs per transistor.

Hi Jack,

That was a great post. I'm in a similar situation and I was wondering if you could give me some more info.

I got some LED strings which supposedly had a twinkle effect, but when they arrived it was more like a strobe light effect.

I already got an Arduino UNO and a relay so I would be able to turn the lights on and off remotely, but now I'm thinking that I could create the desired twinkling effect using the Arduino too.

My limited understanding is that the lights (which are mains power in my case) are powered via a bridge rectifier to DC, and there are effectively two channels of live and one ground wire.

I didn't know anything about this stuff when I started the project; if I had, I might have gone with one of those fibre optic setups that has LEDs reflected off of a rotating disk into the fibers to create a twinkling effect. However, I want to use the stuff I already bought, so I understand the effect will be pretty limited with only 2 groups to control.

I'm interested in how controlling these groups would actually work and what the easiest way to do that might be.

You mentioned that one can only control a few LEDs per PNP transistor. How might I go about controlling a whole string? Mains voltage is 220-230v here.

I was thinking a possible solution would be to control two PNP transistors (for the two channels) via the UNO's PWM pins, and then use the transistors to control a solid state relay, but I have no idea if that would work or how rapidly that type of relay can be switched. I was surprised by how loud normal relays are when I was testing mine, it's fine for on and off but it will be annoying to hear all the time when the lights are on.

Another, possibly simpler solution would be to piggy-back on the existing controllers. Watching one of bigclive's videos on YouTube, it seems like the effects are generated from the DC pulses themselves, using whatever the polling rate is (50hz?) as a timer. There seems to be a little controller in there on a perpendicular board but it's potted with epoxy so I can't get at it. If you think this would be a viable solution I can take some pictures of the board as I'm not really sure what I'm looking at (apart from the rectifier, controller and a few capacitors).

I've really been struggling to find info relevant to my specific case so I'd be super thankful if you would help me out.