Example #1
0
        public int RandomRestOrNote()
        {
            var differentEvents = DifferentEvents.Where(e => e != (int)RestOrTie.Tie).ToList();
            var index           = ThreadSafeRandom.ThisThreadsRandom.Next(differentEvents.Count);

            return(differentEvents[index]);
        }
Example #2
0
        public int RandomEventWithRate()
        {
            var type = GetTypeByRate();

            if (type == typeof(Note))
            {
                var differentNotes = DifferentEvents.Where(e => e != (int)RestOrTie.Tie && e != (int)RestOrTie.Rest).ToList();
                var index          = ThreadSafeRandom.ThisThreadsRandom.Next(differentNotes.Count);
                return(differentNotes[index]);
            }
            else if (type == typeof(Rest))
            {
                return((int)RestOrTie.Rest);
            }
            else
            {
                return((int)RestOrTie.Tie);
            }
        }