@include test-module('_rand') {
  $list: null null null null null null null null null null null null null null null null null null null null;
  $actual: _map($list, _rand);

  @include test('should return 0 or 1 when arguments are not provided') {
    @include assert-true(test-lists-equal(__sort(_uniq($actual)), (0, 1)));
  }

  $min: 5;
  $max: 10;

  $is-within-range: true;

  @each $item in $list {
    $result: _rand($min, $max);
    $is-within-range: $result >= $min and $result <= $max;
  }

  @include test('should support a min and max argument') {
    @include assert-equal($is-within-range, true);
  }

  $min: 0;
  $max: 5;

  $is-within-range: true;

  @each $item in $list {
    $result: _rand($max);
    $is-within-range: $result >= $min and $result <= $max;
  }

  @include test('should support not providing a max argument') {
    @include assert-equal($is-within-range, true);
  }

  @include test('should coerce arguments to numbers') {
    @include assert-equal(_rand('1', '1'), 1);
  }

  $min: 1.5;
  $max: 1.6;
  $actual: _rand($min, $max);

  @include test('should support floats') {
    @include assert-equal($actual % 1 > 0, true);
  }

  @include test('should support floats') {
    @include assert-equal($actual >= $min and $actual <= $max, true);
  }

  $actual: _rand(true);
  $actual: if($actual % 1 == 0, _rand(true), $actual);

  @include test('should support providing a floating argument') {
    @include assert-equal($actual % 1 > 0 and $actual >= 0 and $actual <= 1, true);
  }

  $actual: _rand(2, true);
  $actual: if($actual % 1 == 0, _rand(2, true), $actual);

  @include test('should support providing a floating argument') {
    @include assert-equal($actual % 1 > 0 and $actual >= 0 and $actual <= 2, true);
  }

  $actual: _rand(2, 4, true);
  $actual: if($actual % 1 == 0, _rand(2, 4, true), $actual);

  @include test('should support providing a floating argument') {
    @include assert-equal($actual % 1 > 0 and $actual >= 2 and $actual <= 4, true);
  }

  $list: 1 2 3 4 5 6 7 8 9 10;
  $randoms: _map($list, _rand);
  $result: true;

  @each $random-index, $random-value in zip($list, $randoms) {
    $result: $result and $random-value >= 0 and $random-value <= $random-index and $random-value % 1 == 0;
  }

  @include test('should work as an iteratee for _map') {
    @include assert-equal($result, true);
  }

}