inRandomOrder method

  1. @override
QueryBuilder inRandomOrder([
  1. dynamic seed
])
override

Implementation

@override
QueryBuilder inRandomOrder([dynamic seed]) {
  if (seed != null) {
    // The seed is interpolated into the statement, so it has to be a
    // number. `inRandomOrder(request.input('seed'))` was otherwise a
    // direct injection point.
    if (seed is! num && num.tryParse(seed.toString()) == null) {
      throw InvalidArgumentException(
        'inRandomOrder seed must be numeric, got: "$seed".',
      );
    }
    _orderBy.add("RAND($seed)");
  } else {
    _orderBy.add("RAND()");
  }
  return this;
}