I have this kind of eloquent query where I need to take random rows from a table, with a limit, but it returns wrong, when I use limit, then it pulls only one row, no matter what number I take in as a limit. And when I don't use limit it returns random number of rows. Don't know what I am missing. This is the code.
$questions = $query->whereRaw('RAND()')->take($limit)->get();
Thanks in advance!