4 digit unique number generator



Hi everyone,

I am working on an embedded linux project that requires me to generate
a unique 4 digit code based on my device id.
My device ID could go from 1 - 1024. Is there a simple mathametical
formula that I could use to generate the required number. I try to
write something on my own and I am not successful at generating unique
numbers.

Any help is much appericiated! Thanks everyone!

EZ

.