In a conversation with my Spanish teacher, I found out that in Spain, public parks are normally enclosed by iron fences, with gates in them that can be locked.
The United States is a big country, customs vary, and I certainly can't say I know all of it, but my experience has been that in the United States public parks are not gated or locked. I know this is true of Central Park in New York, the Public Garden and Boston Common in Boston, Vilas Park in Madison, Wisconsin, Munsinger and Clemens Gardens in St. Cloud, Minnesota, the public parks in all the little towns around here, and so forth and so on.
Where you live, are the public parks gated and locked at night, or are they open?
In Australia, public parks are completely open. I'm now living in Amsterdam, and a lot of (but not all) parks here are fenced. I've also noticed that a lot of parks have fences elsewhere in Europe. I don't know if they're locked up at night - at the very least, I've never noticed one locked up and I tend to be out very late.
Something else that I've noticed (but never made a connection to the fenced thing until now) is that a lot of parks in Europe were once the property of nobility, and later donated to the public. I suspect that older parks will be fenced and newer ones won't be, although that's not something I've got data for.