Forecasting pedestrian trajectories in dynamic scenes remains a critical problem with various applications, such as autonomous driving and socially aware robots. Such forecasting is challenging due to human-human and human-object interactions and future uncertainties caused by human randomness. Generative model-based methods handle future uncertainties by sampling a latent variable. However, few previous studies carefully explored the generation of the latent variable. In this work, we propose the Trajectory Predictor with Pseudo Oracle (TPPO), which is a generative model-based trajectory predictor. The first pseudo oracle is pedestrians' moving directions, and the second one is the latent variable estimated from observed trajectories. A social attention module is used to aggregate neighbors' interactions on the basis of the correlation between pedestrians' moving directions and their future trajectories. This correlation is inspired by the fact that a pedestrian's future trajectory is often influenced by pedestrians in front. A latent variable predictor is proposed to estimate latent variable distributions from observed and ground-truth trajectories. Moreover, the gap between these two distributions is minimized during training. Therefore, the latent variable predictor can estimate the latent variable from observed trajectories to approximate that estimated from ground-truth trajectories. We compare the performance of TPPO with related methods on several public datasets. Results demonstrate that TPPO outperforms state-of-the-art methods with low average and final displacement errors. Besides, the ablation study shows that the prediction performance will not dramatically decrease as sampling times decline during tests.