the_widget() and widget’s ID

I believe @One Trick Pony was right.

Shortcode widgets have no ID, so I’ve found a way around.

Firstly I used PHP rand function:

$var = rand();

And then added the “var” to the ID, so it doesn’t collide with other shortcodes calling the same widget (each one has different random number at the end of the ID):

<div id="myWidget-<?php echo $var?>;"></div>