\documentclass[french]{article}
\usepackage{geometry}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{tikz}

\usepackage{amssymb}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
%\setlength{\PreviewBorder}{2pt}%  marge

\usepackage{pgffor}
%%%%
\def\hauteur{5}
\def\largeur{4}

\pgfmathdeclarerandomlist{MyRandomColors}{%
{red}%
{red!25}%
{magenta}%
{magenta!25}%
{olive}%
{olive!25}%
{brown}%
{brown!10}%
{violet}%
{violet!25}%
{gray}%
{purple}%
{yellow}%
{orange}%
{orange!25}%
{cyan}%
{green}%    
}

\begin{document}
\begin{tikzpicture}[x=1cm, y=1cm]

% source : http://www.texample.net/tikz/examples/membrane-ions/

%\pgfmathrandomitem{\choice}{ones} %%%%%%%%%%

\foreach \i in {0,1,...,10}{
\foreach \j in {0,1,...,12}{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfmathparse{0.9*rnd+0.3}
%\definecolor{MyColor}{rgb}{\pgfmathresult,\pgfmathresult,\pgfmathresult}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ou bien
\pgfmathrandomitem{\RandomColor}{MyRandomColors}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfmathrandominteger{\x}{1}{100}




\ifnum  \x<30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\draw (\i/2.9+0.2,\j/3+0.2)  node[rotate=0 ] {\textcolor{MyColor}{$\bullet$}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ou bien
\draw (\i/2.9+0.2,\j/3+0.2)  node[rotate=0 ] {\textcolor{\RandomColor}{$\bullet$}};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fi
}
}

% bécher
\draw  [line width=2pt] (0,\hauteur) -- (0,-0) -- (\largeur,0)-- (\largeur,\hauteur*0.95)-- (\largeur+\hauteur*0.04,\hauteur);
\end{tikzpicture}
\end{document}