Show More
Commit Description:
Clean up warnings.
Commit Description:
Clean up warnings.
References:
File last commit:
Show/Diff file:
Action:
isometric-park-fna/Utils/Extensions.cs
24 lines | 404 B | text/x-csharp | CSharpLexer
24 lines | 404 B | text/x-csharp | CSharpLexer
r132 | ||||
using System; | ||||
using System.Collections.Generic; | ||||
namespace isometricparkfna | ||||
{ | ||||
public static class Extensions | ||||
{ | ||||
public static List<T> Shuffle<T> (this List<T> source) { | ||||
Random rnd = new Random(); | ||||
for(int i = (source.Count-1); i >= 0 ; i--) { | ||||
var j = rnd.Next(0, (source.Count-1)); | ||||
var tmp = source[j]; | ||||
source[j] = source[i]; | ||||
source[i] = tmp; | ||||
} | ||||
return source; | ||||
} | ||||
} | ||||
} | ||||