<p><code>.order()</code> is deprecated in Craft 3 and doesn't work in Craft 4, use <code>orderBy()</code> instead.</p>
<pre><code>{% for entry in craft.entries.section('team').type('mainPeople').orderBy('RAND()') %}
</code></pre>

CC BY-SA 4.0
2023-03-16T17:32:48.977Z
2023-03-16T23:56:08.523Z
2023-03-16T23:56:08.523Z
Samuel
<p>You can use MySQL's <a href="http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand">RAND()</a> function inside your order method:</p>

<pre><code>{% for entry in craft.entries.section('team').type('mainPeople').order('RAND()') %}
</code></pre>

CC BY-SA 3.0
2014-09-23T12:35:31.290Z
Doh! I'd tried that, but forgot the quote marks. Thanks.
Willans
CC BY-SA 3.0
2014-09-23T11:20:58.700Z
2014-09-23T11:20:58.700Z
Mike Pepper
<p>I was wondering if it's was possible to order section entries by random.</p>

<p>Example:</p>

<pre><code>{% for entry in craft.entries.section('team').type('mainPeople').order('title random)) %}
</code></pre>

<templating><entries><ordering>
Section entries - order by random
# Section entries - order by random

(Asked by: username_0 on 2014-09-23)

I was wondering if it's was possible to order section entries by random.
Example:
{% for entry in craft.entries.section('team').type('mainPeople').order('title random)) %}

**Tags:** templating, entries, ordering


---

## 2 answers

### Answer by username_2 on 2014-09-23. Score: 48 | Accepted answer

You can use MySQL's RAND() function inside your order method:
{% for entry in craft.entries.section('team').type('mainPeople').order('RAND()') %}

> **Comments:**
> **username_0**: Doh! I'd tried that, but forgot the quote marks. Thanks.  

---

### Answer by username_1 on 2023-03-16. Score: 1

.order() is deprecated in Craft 3 and doesn't work in Craft 4, use orderBy() instead.
{% for entry in craft.entries.section('team').type('mainPeople').orderBy('RAND()') %}


---

