dotnet / dotnet/efcore

Support Shuffle Linq method

Open
#35,819 1 comment 4 reactions 0 assignees View on GitHub
area-query customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### What problem are you trying to solve?

New linq method `Shuffle` introduced since .NET 10 preview 2, maybe we could support this to simplify the random pick operation

https://github.com/dotnet/runtime/issues/111221

### Describe the solution you'd like

**SQL Server**

```sql
SELECT TOP 10 * FROM your_table ORDER BY NEWID();
```

---

**MySQL**

```sql
SELECT * FROM your_table ORDER BY RAND() LIMIT 10;
```

---

**PostgreSQL**

```sql
SELECT * FROM your_table ORDER BY RANDOM() LIMIT 10;
```

---

**SQLite**
```sql
SELECT * FROM your_table ORDER BY RANDOM() LIMIT 10;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.