In smart card based authentication scheme, we generally say that smart card generates random numbers or computes some parameters? How smart card performs these operations?
Currently most of smart cards are java based so you can write a small applet in java and can load on smart card. A lot of Java card examples are available. Please just google those.
Even you can perform complex crypto functions such as DES encryption, RSA encryption instead of simple random number generation.
How to use smart card for authentication, it depends which protocol you are using like username/password, digest, token based or may be strong authentication.