C#C
C#11mo ago
AsyncAndy

Enumerable.OrderBy help

I'm following a tutorial and they randomly get an element of an enumerable like this:

return unvisitedCells.OrderBy(_ => Random.Range(0, 10)).FirstOrDefault();


I'm a bit confused as to how this works. I looked up the docs for .OrderBy and kind of understand how it's usually meant to be used, but I don't see what throwing a random number in there does exactly.
Was this page helpful?