title: Trying to seed Faker in a Laravel factory produces PHP error 'Undefined offset'
body: <p>I have the following Factory in Laravel 5.5</p>
  
  <pre><code>use Faker\Generator as Faker;
  
  $factory-&gt;define(App\Student::class, function (Faker $faker, $form) {
      //$faker-&gt;addProvider(new \Faker\Provider\SIMS($faker));
      $faker-&gt;seed(1234);
      echo $faker-&gt;name;
  });
  </code></pre>
  
  <p>When I run <code>php artisan db:seed</code> I get the error <code>In Base.php line 194: Undefined offset: -57</code> with the offset being different depending on what value I use for <code>$faker-&gt;seed(1234)</code>. Leaving this line out of the factory causes the seed to run successfully but obviously I end up with different data each time, hence the need to seed Faker.</p>
  
  <p>Base.php is part of Faker and looks like this</p>
  
  <pre><code>public static function randomElements(array $array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false)
      {
          $allKeys = array_keys($array);
          $numKeys = count($allKeys);
  
          if (!$allowDuplicates &amp;&amp; $numKeys &lt; $count) {
              throw new \LengthException(sprintf('Cannot get %d elements, only %d in array', $count, $numKeys));
          }
  
          $highKey = $numKeys - 1;
          $keys = $elements = array();
          $numElements = 0;
  
          while ($numElements &lt; $count) {
              $num = mt_rand(0, $highKey);
  
              if (!$allowDuplicates) {
                  if (isset($keys[$num])) {
                      continue;
                  }
                  $keys[$num] = true;
              }
  
              $elements[] = $array[$allKeys[$num]];  //THIS IS LINE 194.
              $numElements++;
          }
  
          return $elements;
      }
  </code></pre>
  
  <p>I have not modified it since installing Laravel.</p>
  
  <p>The Student Factory is being called by the Form Factory like so</p>
  
  <pre><code>factory(App\Form::class, $numberOfStudentsInForm)-&gt;create()-&gt;each(function ($form)
          {
              echo ("Seeding Students of Form $form-&gt;name\r\n");
              factory(App\Student::class, 30)-&gt;create(['form_id'=&gt;$form]);
          });
  </code></pre>
  
  <p>The Student Model looks like this</p>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  
  class Student extends Model
  {
      use SoftDeletes;
  
      protected $primaryKey = "admission_number";
      public $incrementing = false;
      protected $keyType = "string";
  
      public function form()
      {
          return $this-&gt;belongsTo('App\Form');
      }
  
      public function grades()
      {
          return $this-&gt;hasMany('App\Grade');
      }
  
      public function delete()
      {
          return ($this-&gt;grades()-&gt;delete() &amp;&amp; parent::delete());
      }
  }
  </code></pre>
  
  <p>Am I doing something wrong?</p>