The definition of "available ram" is not at all clear on a modern system. Would the contents of purgeable memory count as "available"? It's in use, but will be cleared as soon as there's any memory pressure. What about mmap()'d files?
I found two articles for finding available memory...on the iPhone. I haven't looked at them, but due to the similarities of the platforms, I'm sure you could probably modify them a bit, or even just use them outright.
top is a unix utility that (among other things) lists free ram; like most of the unix layer of OSX, it's open source. Therefore, you can read its code to find out how to do it.
It matters because the people that you are depending on to be smarter than you (hence you asking them questions), are smarter than you and know that this value is relatively meaningless on MacOS X (at least the non-iPhone version).
In general when you are looking for help you should start out explaining what you are trying to do (broad strokes) then describe your specific question. More often than not the reason you can't seem to do what you think you need to do is because you don't understand what is going on. Thus you need to accept that other people need more information than you might think.