One of the best-selling T-shirts for the Indian e-commerce site Myntra is an olive, blue and yellow colorblocked design. It was conceived not by a human but by a computer algorithm — or rather two algorithms.

The first algorithm generated random images that it tried to pass off as clothing. The second had to distinguish between those images and clothes in Myntra’s inventory. Through a long game of one-upmanship, the first algorithm got better at producing images that resembled clothing, and the second got better at determining whether they were like — but not identical to — actual products.

This back and forth, an example of artificial intelligence at work, created designs whose sales are now “growing at 100 percent,” said Ananth Narayanan, the company’s chief executive. “It’s working.”

Clothing design is only the leading edge of the way algorithms are transforming the fashion and retail industries. Companies now routinely use artificial intelligence to decide which clothes to stock and what to recommend to customers.