void DisplayTask3() { Console.WriteLine("-------------Part1----------------"); HomeWork.Task3.CreatingList crea = new CreatingList(); crea.create(); Console.WriteLine("-------------Part2----------------"); HomeWork.Task3.Addrange addrange = new Addrange(); addrange.Addrang(); Console.WriteLine("-------------Part3----------------"); HomeWork.Task3.RandomList rnd = new RandomList(); rnd.Randstr(); rnd.SearchZ(); rnd.SearchEqual(); Console.Write("Input PageNumber:"); int PageNumber = Convert.ToInt32(Console.ReadLine()); rnd.PageNumber(PageNumber); }
static void Main(string[] args) { RandomList show = new RandomList(50, 10); show.TotalSum(); show.Sort(); }
/// <summary> /// Constructor /// </summary> /// <param name="Neat"><see cref="IGenome"/></param> public Genome(INeat Neat) { Connections = new RandomList <ConnectionGene>(); Nodes = new RandomList <NodeGene>(); this.Neat = Neat; }
/// <summary> /// Constructor /// </summary> /// <param name="Representative"><see cref="Client"/> choosen as representative of a <see cref="Species"/></param> public Species(Client Representative) { Clients = new RandomList <Client>(); this.Representative = Representative; this.Representative.Species = this; Clients.Add(Representative); }
public Station GetRandomStation() { List <Station> availableStations = new List <Station>(); foreach (Station s in stations) { if (s.HasActiveEvent() == false) { availableStations.Add(s); } } if (availableStations.Count == 0) { return(null); } if (availableStations.Count == 1) { return(availableStations[0]); } RandomList <Station> rd = new RandomList <Station>(stations); return(rd.Pick()); }
protected static void RandomSelection_LoadRandomness(RandomSelection __instance) { foreach (RandomListInfo info in RogueLibs.Instance.RandomLists) { __instance.CreateRandomList(info.name, info.category, info.objectType); } foreach (CustomItem item in RogueLibs.Instance.Items) { foreach (KeyValuePair <string, int> pair in item.SpawnDictionary) { RandomList list = null; foreach (RandomList l in __instance.randomListTable.Values) { if (l.rName == pair.Key) { list = l; break; } } if (list != null) { __instance.CreateRandomElement(list, item.Id, pair.Value); } } } }
public void CreatingInstance() { // Act var randList = new RandomList <int>(); // Assert Assert.True(randList.Count == 0); }
public override void OnNavigatingTo(NavigationParameters parameters) { if (parameters.ContainsKey("randomlist")) { this.RandomList = (RandomList)parameters["randomlist"]; this.Title = this.RandomList.Name; } }
[Test] public void InsertOverEndTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.Throws <ArgumentOutOfRangeException>(() => l.Insert(5, 10)); }
[Test] public void InsertEndTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; l.Insert(4, 10); Assert.AreEqual(F.list(1, 2, 3, 4, 10), l); }
void Start() { name = RandomWord.Adverb(); // race.randomName int[] randList = RandomList.FixedSum(3, 50); sneak += randList[0]; smarts += randList[1]; strength += randList[2]; Heal(); }
static void Main(string[] args) { var list = new RandomList() { "Hello", "Olla", "Asta la", "Vista la" }; Console.WriteLine(list.RandomString()); }
/// <summary> /// Constructor /// </summary> public Neat() { AllConnections = new Dictionary <ConnectionGene, ConnectionGene>(); AllNodes = new RandomList <NodeGene>(); AllClients = new RandomList <Client>(); AllSpecies = new RandomList <Species>(); Reset(); }
// test class RandomList static void Main() { var list = new List <string> { "a", "s", "d" }; var randomList = new RandomList(list); Console.WriteLine(randomList.RandomString()); }
[Test] public void InsertMiddleTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; l.Insert(2, 10); Assert.AreEqual(F.list(1, 2, 10, 4, 3), l); }
[Test] public void InsertStartTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; l.Insert(0, 10); Assert.AreEqual(F.list(10, 2, 3, 4, 1), l); }
internal async Task NavigateToDetailPage(RandomList randomList) { var parameters = new NavigationParameters { { "randomlist", randomList } }; await this.navigationService.NavigateAsync("RandomListDetailPage", parameters); }
[Test] public void RemoveAtNonExistingTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.Throws <ArgumentOutOfRangeException>(() => l.RemoveAt(5)); Assert.AreEqual(F.list(1, 2, 3, 4), l); Assert.AreEqual(4, l.Count); }
[Test] public void RemoveNonExistingTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.AreEqual(false, l.Remove(5)); Assert.AreEqual(F.list(1, 2, 3, 4), l); Assert.AreEqual(4, l.Count); }
[Test] public void RemoveFromEndTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; Assert.AreEqual(true, l.Remove(4)); Assert.AreEqual(F.list(1, 2, 3), l); Assert.AreEqual(3, l.Count); }
public string RandomString(RandomList rndList) { Random rnd = new Random(); int randomIndex = rnd.Next(0, rndList.Count); string str = rndList[randomIndex]; rndList.Remove(str); return(str); }
ToggleableMultiplier( float multiplier, RandomList <ToggleableMultiplier> list, IRxRef <float> totalMultiplier, bool active ) { _multiplier = multiplier; this.list = list; this.totalMultiplier = totalMultiplier; _active = active; }
[Test] public void RemoveWhereNoneTest() { var l = new RandomList <int> { 1, 3, 5, 7, 9 }; l.RemoveWhere(i => i % 2 == 0); Assert.AreEqual(F.list(1, 3, 5, 7, 9), l); Assert.AreEqual(5, l.Count); }
public static void Main() { var randomList = new RandomList(); randomList.Add("one"); randomList.Add("two"); randomList.Add("three"); Console.WriteLine(randomList.RandomString()); }
[Test] public void RemoveAtFromMiddleTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; l.RemoveAt(2); Assert.AreEqual(F.list(1, 2, 4), l); Assert.AreEqual(3, l.Count); }
[Test] public void RemoveAtFromStartTest() { var l = new RandomList <int> { 1, 2, 3, 4 }; l.RemoveAt(0); Assert.AreEqual(F.list(4, 2, 3), l); Assert.AreEqual(3, l.Count); }
[Test] public void RemoveWhereAllTest() { var l = new RandomList <int> { 2, 4, 6, 8, 10 }; l.RemoveWhere(i => i % 2 == 0); Assert.AreEqual(F.emptyList <int>(), l); Assert.AreEqual(0, l.Count); }
static void Main() { var randomList = new RandomList(); randomList.Add("34wfsdsd"); randomList.Add("444"); randomList.Add("asdf"); randomList.Add("55"); Console.WriteLine(randomList.RandomString()); }
public void CreatingInstance_Passing_IEnumerable() { // Arrange var list = Enumerable.Range(0, 10); // Act var randList = new RandomList <int>(list); // Assert Assert.True(randList.Count == list.Count()); }
public void GetItemRandomly() { // Arrange var randList = new RandomList <int>(Enumerable.Range(0, 10)); // Act int item = randList.GetItemRandomly(); // Assert Assert.Contains(item, randList); }
public void TestCase() { var list = new RandomList<int>(new Random(239823), new int[]{0,1,2,3,4,5}); long start = DateTime.Now.ToFileTimeUtc(); int end = 1 << 6; // 24; int last = -1; for (int i = 0; i < end; i++) { int item = list.RandomItem(); // Console.Write(item.ToString()); Assert.True(item != last); last = item; } double seconds = (DateTime.Now.ToFileTimeUtc() - start) / 10000000.0; // Console.WriteLine(""); Console.WriteLine(seconds); // Assert.False(true); }