Polynomial state of the electromagnetic field: generation and statistical properties