I used to use the freebies on offer here, which are reasonable. This was several years ago however. At this point, there probably is a freeware drum machine software on sourceforge or something like that.

One option would be to use tuxguitar or something like that to program beats, then transfer them into whatever recording program, then loop them and play over them.