You can start with something like this. Code for \randomcolor
was taken from Generate random color in way that works with both pdflatex and lualatex
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm}
\setbeamertemplate{frametitle}[default][center]
\usepackage{tikz}
\newcommand{\randomcolor}{%
\pgfmathsetmacro{\R}{random(0,10000)/10000}%
\pgfmathsetmacro{\G}{random(0,10000)/10000}%
\pgfmathsetmacro{\B}{random(0,10000)/10000}%
\definecolor{randomcolor}{rgb}{\R,\G,\B}%
}
\newcommand{\tikzcircle}[1]{\randomcolor\tikz[baseline=-0.5ex]{\fill[randomcolor,radius=#1]circle;}}%
\pgfmathsetseed{\number\pdfrandomseed} % seed for random generator
\begin{document}
\begin{frame}{The counting problem}
\foreach \j in {1,2,...,5} {\foreach \i in {1,2,...,10} {\tikzcircle{.05\textwidth}}\\}
\end{frame}
\end{document}
Update: limited colors
Following code shows an alternative to select colors from a limited set. The set is defined into a TikZ
array and the color is selected with a random index.
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm}
\setbeamertemplate{frametitle}[default][center]
\usepackage{tikz}
\def\mycolors{{"red","green","blue","brown","pink","violet","orange","cyan","yellow"}}
\newcommand{\tikzcircle}[1]{%
\pgfmathsetmacro{\mycolorindex}{random(0,8)}%
\pgfmathsetmacro{\mycolor}{array(\mycolors,\mycolorindex)}%
\tikz[baseline=-0.5ex]{\fill[\mycolor,radius=#1]circle;}}%
\pgfmathsetseed{\number\pdfrandomseed} % seed for random generator
\begin{document}
\begin{frame}{The counting problem}
\foreach \j in {1,2,...,5}{\foreach \i in {1,2,...,10}{\tikzcircle{.05\textwidth}}\\}
\end{frame}
\end{document}