linq pick random element

78

Linq - Random Elements -

var rnd = new Random();
var SelectedPost = q.OrderBy(x => rnd.Next()).Take(1);

linq pick random element -

var rand = new Random();
var user = users[rand.Next(users.Count)];

Comments

Submit
0 Comments