So, here's how, courtesy of this blog post over at Fontis:
<?php
$i = 1;
$numberofprods = 100;
$numberofprods = range($i,$numberofprods);
foreach($numberofprods as $product) {
++$i; $name = "Product Number ".$i;
$product = Mage::getModel('catalog/product');
$product->setSku($i);
$product->setName($name);
$product->setDescription("This widget will give you years of trouble-free widgeting.");
$product->setShortDescription("High-end widget.");
$product->setPrice(99.99);
$product->setTypeId('simple');
$product->setAttributeSetId(4); // need to look this up
$product->setCategoryIds("3,8"); // need to look these up
$product->setWeight(1.0);
$product->setTaxClassId(2); // taxable goods
$product->setVisibility(4); // catalog, search
$product->setStatus(1); // enabled
// assign product to the default website
$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
$product->save();
}; ?>
It's best to do this in batches as it seems to be quite a processor heavy task, so I added the amount as a range - so for example you can have $i = 1;$numberofprods = 1000; and then when that's finished $i = 1001;$numberofprods = 2000; and so on.
To run it, I simply saved it as a template file in app/design/frontend/default/template/createproducts.phtml and then called that from a CMS page like {{block type="core/template" template="createproducts.phtml"}}. Then each time you load that page it'll run and create your products.