Embracing Randomness: Algorithms and Generative AI