Try this:
$("li").each(function(i, e) {
$(e).attr("id", "_id" + i);
});
You can, for instance, use randomized stream of characters to impersonate IDs. Maybe this is what you’re intending to do. It’s tough to figure out what you want from such a short description. However, I hope it helps.