[Tex/LaTex] How to display chapter number in big numerical next to chapter title

chaptersfontsizeformatting

I would like to display on the first page of every chapter, the chapter's name, followed by some spacing and then the chapter's number in big gray numerals. Also the number should be displayed in a slightly lighter gray font than the normal text.I have illustrated with a rectangle in the figure below (including relative font size) the region where the chapter's number should appear relative to the title.

enter image description here

Edit minimal working example shown next.

\documentclass[10pt,twoside]{book}

% todo modify this to display chapter name and number as shown in figure above.      
\titleformat{\chapter}[display]
    {\bfseries\Huge\sffamily}
    {\vspace{-0.9in}\filright{\LARGE{\chaptername} \thechapter}} 
    {0pt}
    {\rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\filright\\[20pt]}
    [\vspace{2ex}\titlerule\vspace{16pt}]



\usepackage{currfile}
\usepackage{lipsum}

\usepackage{shorttoc}
\usepackage{tocbibind}
% http://ctan.org/pkg/bookmark
\usepackage{bookmark}          
\usepackage{listings}
\usepackage{wrapfig}

% Page dimensions required by publisher
\usepackage[paperwidth=16.99cm,paperheight=24.4cm]{geometry}



\usepackage{float}

\begin{document}
\chapter{Random Number Generators}
blablabla
\end{document}

Edit 2 The solution given by Bernard below is exactly what I need. I still 2 issues: i omitted in the MWE to specify my exact page dimensions. So now the chapter number is out of the page at the moment (see screenshot below). I have updated the MWE to include the page dimensions. In a more general way, what are the parameters which govern the positioning of the chapter number?

enter image description here

The second issue is that now I have the work "Chapter" being displayed in my preface and TOC (frontmatter chapters).

enter image description here

Edit 3
Using the advice given in the following answer LaTeX – how do I force PDF page height/width?, I modified my page settings from \RequirePackage[paperwidth=16.99cm,paperheight=24.4cm]{geometry} to \RequirePackage[pass,paperwidth=16.99cm,paperheight=24.4cm]{geometry}. Bernard's solution now works. From the answer given in the previous link, "With the pass option, geometry won't change the class parameters for pagination, as it would do without it".

Output shown below:

enter image description here

Best Answer

Here is a solution, with two (not Fifty) Shades of Grey:

\documentclass[10pt,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{lipsum, graphicx, tabularx}
\usepackage[svgnames]{xcolor}
\usepackage[explicit]{titlesec}
% todo modify this to display chapter name and number as shown in figure above.
\titleformat{\chapter}[block]
    {\bfseries\Huge\sffamily}
    {\rlap{\hspace*{\dimexpr\linewidth+\marginparsep}%
\parbox{\marginparwidth}{\centering\color{Gainsboro}\scalebox{4}{\thechapter}\\[-0.5ex]% \raisebox{-0.3\height}[0pt][0pt]
    \rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}}}}
    {0pt}
    {\color{gray!75}\begin{tabularx}{\linewidth}{@{}>{\raggedright\arraybackslash}X>{\raggedleft\arraybackslash}p{1cm}@{}}
       & \makebox[0pt]{\LARGE\chaptername}\\[2.5ex] #1
    \end{tabularx}}
    [\vspace{1ex}\titlerule\vspace{16pt}]

\titlespacing{\chapter}{0pt}{-5ex}{10ex}

\usepackage{currfile}
\usepackage{lipsum}

\usepackage{shorttoc}
\usepackage{tocbibind}
% http://ctan.org/pkg/bookmark
\usepackage{bookmark}
\usepackage{listings}
\usepackage{wrapfig}

\usepackage{float}

\begin{document}

\chapter{Random Number Generators}

\lipsum[1-5]

\end{document}

enter image description here

For problems with the margin, I propose this variant:

\documentclass[10pt,twoside]{book}
\usepackage[utf8]{inputenc}% Page dimensions required by publisher
\usepackage[paperwidth=16.99cm,paperheight=24.4cm,]{geometry} % showframe
\usepackage{lipsum, graphicx, tabularx}
\usepackage[svgnames]{xcolor}
\usepackage[explicit]{titlesec}
% todo modify this to display chapter name and number as shown in figure above.
\titleformat{\chapter}[block]
    {\bfseries\Huge\sffamily}
    {\rlap{\hspace*{\dimexpr\linewidth+2 \marginparsep}%
    \begin{tabular}{@{}>{\color{Gainsboro}}c@{}}\scalebox{4}{\thechapter}\\[-0.5ex]%
    \rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\end{tabular}}}
    {0pt}
    {\color{gray!75}\begin{tabularx}{\dimexpr\linewidth+4\marginparsep}%
    {@{}>{\raggedright\arraybackslash}X>{\raggedleft\arraybackslash}r@{}}
       & \rule{0pt}{3ex}\LARGE\chaptername\\[0ex] #1
    \end{tabularx}}
    [\vspace{1ex}\titlerule\vspace{16pt}]

\titlespacing{\chapter}{0pt}{-5ex}{10ex}

\usepackage{currfile}
\usepackage{lipsum}

\usepackage{shorttoc}
\usepackage{tocbibind}
% http://ctan.org/pkg/bookmark
\usepackage{bookmark}
\usepackage{listings}
\usepackage{wrapfig}

\usepackage{float}

\begin{document}

\chapter{Random Number Generators}

\lipsum[1-5]
\end{document} 

enter image description here

Related Question