There is another sort of these pastils, called sweets and sours, which are made thus: Take some of the above aromatic paste, and make into cones of 2 inches in length, and of the thickness, at their bases, of an inch. Whilst moist, scoop out a cavity in the bottom of each, capable of containing a large pea, and fill it up with gunpowder, covering this over with the paste which has been scooped out. When to be dried, lay the bottoms of these pastils uppermost; for if any moisture attacks the gunpowder, its effects will be destroyed.
The design (it can hardly be called a useful purpose,) for which these pastils are made, is to produce diversion. During Christmas, or other holiday gambols, it is customary with many to light one of these with the avowed intention of perfuming the apartments, and whilst the company are pleased with the odour, an unexpected report terrifies some, whilst it amuses others."
Pastils are tablets of incense to be burned; they have been used historically to perfume a room for pleasure, to prevent sickness (in times when "bad air" was thought to cause illness), to repel pests... and then there's this one. I recommend you instead purchase legal fireworks and let them off in a safe and authorized fashion!
But, it goes to show that in many ways, people don't change. The excitement and hilarity produced by startling one's friends with an unexpected noise fits equally well in modern college dorm rooms as in this early 19th century recipe.
Source: Mackenzie's Five Thousand Receipts, 1829.