I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
You can get cryptographic-quality random bytes from
/dev/urandom. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10×log2(94) ≈ 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that “passwords must contain at least one special character” (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.