how can i limit the number of instances for my widget

Widget are PHP classes, so you can use static class variables to count how many times a widget is used.

As @Howdy_McGee noted, if your widget show images randomly there are chances that there are widget showing same image even if there are same number of widgets and images, so you need also to address that issue.

This is a rough, untested example that may put you on the way to solve your issue:

class MyRandomImgWidget
{
  private static $inited;
  private static $images;

  function __construct()
  {
    parent::__construct('my-random-img', __('My Random Image', 'text_domain'));
  }

  function init() {
    // get_images_url() below is a placeholder function to be replaced to actual code
    // that retrieve/set images urls.
    self::$images = get_images_url();
    self::$inited = true; // make this method run only once
  }

  function widget() {
    if (is_null(self::$inited)) { // only on first run
      $this->init();
    } elseif(empty(self::$images)) { // do nothing if no images
      return;
    }
    $key = array_rand(self::$images); // get a random key from images array
    $image = self::$images[$key];  // get related image url 
    // remove image from array, so in next call will not used again
    unset(self::$images[$key]);
    printf('<img src="https://wordpress.stackexchange.com/questions/174994/%s" alt="" />', $image); // print the image
  }
}