Whenever I click on Anyone's profile to check if available(online) or even my profile,it doesn't show correctly. When I click on my profile it should show online, but it just show last seen a random time ago
The "last seen..." counter is updated at periodic intervals a few minutes apart, as documented in this answer and this one in the Mother Meta. (Basically, continuously checking every second whether every SE user ever is active would be an excessive load for the Stack Exchange servers.) As such, it is expected to be an imperfect measure.
If you observe large deviations, then this might be more interesting. However, the amount of quantitative detail in the data that you've reported,
it just show last seen a random time ago,
is not enough to say anything other than "yeah, this is just by design".