Version: v2.4.0
rand
Retrieve a random set of records from a table.
rand($table, $columns, $where)
table [string]
The name of the table to query.
columns [string/array]
The column or columns to retrieve.
where [array] (optional)
The WHERE clause used to filter the result set.
rand($table, $join, $columns, $where)
table [string]
The name of the table to query.
join [array]
The join definitions used to combine related tables. Omit this parameter if no joins are required.
columns [string/array]
The column or columns to retrieve.
where [array] (optional)
The WHERE clause used to filter the result set.
Return Value
[array] A randomly ordered result set from the table.
$data = $database->rand("account", [
"user_name",
"email"
], [
"user_id[>]" => 100
]);
// Example result:
// array(
// [0] => array(
// "user_name" => "foo",
// "email" => "foo@medoo.in"
// ),
// [1] => array(
// "user_name" => "cat",
// "email" => "cat@medoo.in"
// )
// )