File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Assets/JCSUnity/Scripts/Util Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ private static float FindDecimalInclude(float num)
223223 }
224224
225225 /// <summary>
226- /// Choose object(s) from the collections .
226+ /// Choose object(s) from the collection .
227227 /// </summary>
228228 public static T ChooseOneE < T > ( params T [ ] args ) // Ellipsis
229229 {
@@ -249,10 +249,6 @@ public static List<T> Choose<T>(int size, ICollection<T> lst)
249249
250250 return chosen ;
251251 }
252-
253- /// <summary>
254- /// Choose object(s) from the collection.
255- /// </summary>
256252 public static KeyValuePair < T , K > ChooseOneE < T , K > ( params KeyValuePair < T , K > [ ] args ) // Ellipsis
257253 {
258254 return ChooseOne ( args ) ;
@@ -290,6 +286,26 @@ public static T EnumValue<T>()
290286 return ( T ) v . GetValue ( r . Next ( v . Length ) ) ;
291287 }
292288
289+ /// <summary>
290+ /// Return a shuffled collection.
291+ /// </summary>
292+ public static ICollection < T > ShuffleE < T > ( params T [ ] col )
293+ {
294+ return Shuffle ( col ) ;
295+ }
296+ public static ICollection < T > Shuffle < T > ( ICollection < T > col )
297+ {
298+ return col . OrderBy ( x => Random . value ) . ToArray ( ) ;
299+ }
300+ public static ICollection < KeyValuePair < T , K > > ShuffleE < T , K > ( params KeyValuePair < T , K > [ ] dict )
301+ {
302+ return Shuffle ( dict ) ;
303+ }
304+ public static ICollection < KeyValuePair < T , K > > Shuffle < T , K > ( ICollection < KeyValuePair < T , K > > dict )
305+ {
306+ return dict . OrderBy ( x => Random . value ) . ToArray ( ) ;
307+ }
308+
293309 /// <summary>
294310 /// Return a random point in bounds.
295311 /// </summary>
You can’t perform that action at this time.
0 commit comments