using System.Collections; using System.Collections.Generic; using Godot; using System; namespace Rokojori { public class RandomList { List _list = new List(); int _pointer = 0; public T Next() { var element = _list[ _pointer ]; _pointer = ( _pointer + 1 ) % _list.Count; return element; } public static List Randomize( List data, RandomEngine r ) { return new RandomList( data, r ).GetList(); } public RandomList( List data, RandomEngine r = null ) { r = RandomEngine.CreateIfNull( r ); var copy = new List(); copy.AddRange( data ); while ( copy.Count > 0 ) { _list.Add( r.RemoveFrom( copy ) ); } } public List GetList() { return _list; } } }