In theory, JRPG random battles are an attrition mechanism. The resulting drain on resources (usually consumables and MP) should, and very occasionally does, produce tension. In practice, JRPG (and Western RPG) designers are usually generous with resources, and few battles are tough enough to threaten a Game Over. This makes them filler. At best, a well-designed battle system can make them enjoyable filler (Final Fantasy X). At worst, they are a waste of the player’s time. Modern JRPGs have largely abandoned them, for which I’m thankful — I find them one of the greatest annoyances in the genre.
What makes random battles particularly bad is that they deprive players of choice and control. At any moment in a RPG, I will have an objective — follow the plot, grind, explore, backtrack, and so on. If I’m grinding, I want to fight lots of battles — ideally against XP-rich foes. Random battles may not occur when I want them, and when they do pop up, they may pit me against the “wrong” foe. Conversely, if I’m exploring or backtracking, I usually don’t want to be interrupted, and that makes random battles a chore. If I’m following the plot, I may not mind fighting a certain number of battles, but eventually I want to find out what happens next, and at that point, further random battles may become a drag.
The usual solution is simple: allow players to see – and, importantly, avoid – monsters on the world or dungeon map. If you want to fight, you charge the monsters, and if you don’t, you go around. This was the system used by Chrono Trigger in 1995, at the tail end of the SNES era, although it took inexplicably long to catch on. (Ni no Kuni is an example of how not to implement this; NNK’s monsters are visible, but in the early game, move so fast they can’t be avoided. They are also numerous. This produces the same effect as random battles with a high encounter rate.)
Once monsters become visible, designers can refine the system in several ways. They can give the player choices beyond “bump into monster/avoid monster”; for instance, in Valkyrie Profile, Valkyrie Profile 2, and Child of Light, paralysing monsters on the dungeon map allows you to safely pass by. In Persona 3 and 4, sneaking up on monsters from behind will grant the first move in combat. Games can also reveal the composition of monster groups before battle, as in Xenoblade Chronicles and Final Fantasy XII. This allows players to make informed decisions about risk versus reward, and also makes it much easier to farm specific monsters.
The common thread is the importance of player agency – something nonexistent under a system of random battles. I can see random battles working as part of an overall emphasis on tension and resource scarcity — FTL uses randomness to great effect. Given that most JRPGs have very different design goals, this is one mechanic they can do without.