  A polynomial threshold function (PTF) $f:\mathbb{R}^n \rightarrow \mathbb{R}$
is a function of the form $f(x) = \mathsf{sign}(p(x))$ where $p$ is a
polynomial of degree at most $d$. PTFs are a classical and well-studied
complexity class with applications across complexity theory, learning theory,
approximation theory, quantum complexity and more. We address the question of
designing pseudorandom generators (PRG) for polynomial threshold functions
(PTFs) in the gaussian space: design a PRG that takes a seed of few bits of
randomness and outputs a $n$-dimensional vector whose distribution is
indistinguishable from a standard multivariate gaussian by a degree $d$ PTF.
  Our main result is a PRG that takes a seed of $d^{O(1)}\log ( n /
\varepsilon)\log(1/\varepsilon)/\varepsilon^2$ random bits with output that
cannot be distinguished from $n$-dimensional gaussian distribution with
advantage better than $\varepsilon$ by degree $d$ PTFs. The best previous
generator due to O'Donnell, Servedio, and Tan (STOC'20) had a quasi-polynomial
dependence (i.e., seedlength of $d^{O(\log d)}$) in the degree $d$. Along the
way we prove a few nearly-tight structural properties of restrictions of PTFs
that may be of independent interest.
