Throughout history, cultures around the world have come up with lots of folk prognostications for predicting the sex assigned at birth. If the mother craves sweets, it’s a girl; if she eats a lot of garlic, it’s also a girl. Have a healthy glow? It’s a boy. Pupils constantly dilated? Boy. Develop acne? Definitely a girl. As it turns out, this type of fortune-telling has been around for even longer than researchers thought; Bonnie Burton at CNET reports that a newly deciphered 3,500-year-old Egyptian papyrus details a relatively elaborate way to find out a baby’s sex.

The trick comes from the Papyrus Carlsberg Collection held at the University of Copenhagen. Though the trove of ancient documents were purchased and collected in the 1930s, many of the documents and scraps of documents have yet to be translated or published. But Lise Brix at ScienceNordic reports that a group of four doctoral students are hard at work to change that, translating Ancient Egyptian texts on medicine, botany, astronomy, astrology and other science—or pseudoscience—topics.

The documents have revealed some interesting details about the Egyptians. For instance, while researchers believed the civilization was not aware of the function of the kidneys, the papyri show that Egyptian were, indeed, conscious of the organs and, in fact, were the first known people to write about them in a medical text.

Texts on astrology also reveal the central place the science of consulting the stars played in Egyptian life. Like other cultures, rulers based major decisions, like whether to go to war, on an astrologer’s interpretation of the heavens.

The 3,500-year-old medical text that includes a process for determining pregnancy and the sex of a baby was also among the trove. To find out, the woman must first urinate into a bag of wheat and a bag of barley. The bag that sprouts first will reveal the pregnancy—barley for boys, wheat for girls, though there is some controversy over the exact grains used and which grain signifies which sex. If neither bag sprouts, it means the woman is not pregnant.

Egyptologists had heard about this test from another papyrus held at the Egyptian Museum of Berlin, but the latest version shows just how widespread the belief was. In a journal article in Clinical Chemistry, Glenn Braunstein describes the wheat and barley test as the first home pregnancy test and a concept that led to the “piss prophets” of the Middle Ages (real title), doctors who diagnosed pregnancy and disease by examining urine. Those doctors would look at the color of urine to determine pregnancy or sometimes they would mix it with wine to see if there was a reaction. Another common test was soaking a ribbon in the woman’s urine then burning it; if the smell made the woman gag, she was with child (and probably needed to air out the house).

In fact, the barley and wheat test itself was extremely long lasting. Sofie Schiødt, the University of Copenhagen Egyptology graduate student who translated the text, says that the test appears in a book of German folklore as late as 1699, and according to one source, was still in practice in Asia Minor in the 1960s. “Many of the ideas in the medical texts from Ancient Egypt appear again in later Greek and Roman texts. From here, they spread further to the medieval medical texts in the Middle East, and you can find traces all the way up to premodern medicine,” she tells Brix of Science Nordic. “That really puts things into perspective, as it shows that the Egyptian ideas have left traces thousands of years later.”

So is there any science behind the ancient test? According to the National Institutes of Health, in 1963 researchers decided to try out the method. In a study published in the journal Medical History they found that wheat and barley watered with urine from men and non-pregnant women kept the grains from sprouting. But in about 70 percent of the cases, the urine from pregnant women did cause the grain to sprout. The test, however, did not accurately predict the sex of the children. It’s possible that increased estrogen levels in the urine could have helped stimulate the seeds.

Which means the Egyptians may have been onto something in this particular case, though most ancient remedies are hogwash at best and endanger lives at worst. Still, understanding what the ancients believed helps us learn about their culture and how their thought influenced—and still influences—ours, making the translation of the thousands of documents in collections around the world a worthwhile effort.