Page 1 of 1

### Need AI Help dealing with trends in Random Numbers Posted: Sun Oct 13, 2013 12:18 am
I created some sample code that select 0-9 number randomly, I know in AI it is not possible to predict which number will come next, but can i Identify which number(s) is leading, at one point in time a set of number(s) might be leading then in another period of time another set of number(s) leads. As theories in equilibrium states given enough rolls they will tend to equalize over a period, or time, how can i construct a AI to identify what number(s) are currently leading? So in others words there are (0-9) numbers, if i needed to find out what top 80%, or even the top 60% of numbers are currently leading, how would i go about doing this?

Also keep in mind i am very new to AI, and the sample code only generate random number and pauses every 500 millisecond when a new number is leading. the code is programmed in C# and i used a tool called Snippet Compiler to run, and compile it which can be found here: http://www.sliver.com/dotnet/snippetcompiler/

To run it just download snippet compiler, then select .Net Framework 3.5 then run.

Code: Select all
`using System;using System.Collections.Generic;public class ColumnPick{   static System.Collections.Hashtable m_ht      = new System.Collections.Hashtable();      //we use enum to create our coin    public enum Face { Zero =0, One = 1, Two, Three, Four, Five, Six, Seven, Eight, Nine };   private static string[] m_faces = Enum.GetNames(typeof(Face));       //if you do not define a random variable outside of your functions,    //you will get the same random number    private static Random r;      private static Face m_lastface;   private static Face m_curface;         public static Face toss()    {      r = new Random(DateTime.Now.Millisecond);            int value = r.Next(0, 10);              return (Face)Enum.Parse(typeof(Face), m_faces[value]);    }      public static void RunSnippet()   {      Face face;            foreach (string s in m_faces)      {   face = (Face)Enum.Parse(typeof(Face), s);         m_ht.Add(face, 0);      }            int maxIndex = 15000;      int index = 0;            while (index < maxIndex)      {         face = toss();                  if (!m_ht.ContainsKey(face))            m_ht.Add(face, 1);         else            m_ht[face] = (int)m_ht[face] + 1;                  int zero = (int)m_ht[Face.Zero];         int one = (int)m_ht[Face.One];         int two = (int)m_ht[Face.Two];         int three = (int)m_ht[Face.Three];         int four = (int)m_ht[Face.Four];         int five = (int)m_ht[Face.Five];         int six = (int)m_ht[Face.Six];         int seven = (int)m_ht[Face.Seven];         int eight = (int)m_ht[Face.Eight];         int nine = (int)m_ht[Face.Nine];                  if ((zero > one) && (zero > two) && (zero > three) && (zero > four)            && (zero > five) && (zero > six) && (zero > seven) && (zero > eight)            && (zero > nine)){            m_curface = Face.Zero;            index = zero;         }         else if ((one > zero) && (one > two) && (one > three) && (one > four)            && (one > five) && (one > six) && (one > seven) && (one > eight)            && (one > nine)){            m_curface = Face.One;            index = one;         }         else if ((two > zero) && (two > one) && (two > three) && (two > four)            && (two > five) && (two > six) && (two > seven) && (two > eight)            && (two > nine)){            m_curface = Face.Two;            index = two;         }         else if ((three > zero) && (three > one) && (three > two) && (three > four)            && (three > five) && (three > six) && (three > seven) && (three > eight)            && (three > nine)){            m_curface = Face.Three;            index = three;         }         else if ((four > zero) && (four > one) && (four > two) && (four > three)            && (four > five) && (four > six) && (four > seven) && (four > eight)            && (four > nine)){            m_curface = Face.Four;            index = four;         }         else if ((five > zero) && (five > one) && (five > two) && (five > three)            && (five > four) && (five > six) && (five > seven) && (five > eight)            && (five > nine)){            m_curface = Face.Five;            index = five;         }         else if ((six > zero) && (six > one) && (six > two) && (six > three)            && (six > four) && (six > five) && (six > seven) && (six > eight)            && (six > nine)){            m_curface = Face.Six;            index = six;         }         else if ((seven > zero) && (seven > one) && (seven > two) && (seven > three)            && (seven > four) && (seven > five) && (seven > six) && (seven > eight)            && (seven > nine)){            m_curface = Face.Seven;            index = seven;         }         else if ((eight > zero) && (eight > one) && (eight > two) && (eight > three)            && (eight > four) && (eight > five) && (eight > six) && (eight > seven)            && (eight > nine)){            m_curface = Face.Eight;            index = eight;         }         else if ((nine > zero) && (nine > one) && (nine > two) && (nine > three)            && (nine > four) && (nine > five) && (nine > six) && (nine > seven)            && (nine > eight)){            m_curface = Face.Nine;            index = nine;         }                  Console.Clear();         Console.WriteLine("Zero: {0}", zero);         Console.WriteLine("One: {0}", one);         Console.WriteLine("Two: {0}", two);         Console.WriteLine("Three: {0}", three);         Console.WriteLine("Four: {0}", four);         Console.WriteLine("Five: {0}", five);         Console.WriteLine("Six: {0}", six);         Console.WriteLine("Seven: {0}", seven);         Console.WriteLine("Eight: {0}", eight);         Console.WriteLine("Nine: {0}", nine);                  if (m_curface != m_lastface){            m_lastface = m_curface;            System.Threading.Thread.Sleep(500);         }      }   }      #region Helper methods      public static void Main()   {      try      {         RunSnippet();      }      catch (Exception e)      {         string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());         Console.WriteLine(error);      }      finally      {         Console.Write("Press any key to continue...");         Console.ReadKey();      }   }   private static void WL(object text, params object[] args)   {      Console.WriteLine(text.ToString(), args);      }      private static void RL()   {      Console.ReadLine();      }      private static void Break()    {      System.Diagnostics.Debugger.Break();   }   #endregion}`