Data privacy has been a hot research topic in the database theory and cryptography communities in the past few decades. To prevent the disclosure of privacy, it requires preserving the anonymity of sensitive attributes in data sharing. The attribute values on quasi-identifiers often have to be generalized before data sharing to avoid linking attack, and thus to achieve the anonymity in data sharing. However, without careful treatment, it’s of high risk of privacy leakage for data anonymity. Among these solutions , data generalization is an important technique for privacy preserving in data publication and attracts considerable attention in the literature, which increases the uncertainty of attribute values, and leads to the loss of information to some extent. The non-homogenous algorithm which is based on ring generalization, can reduce the information loss, and in the meanwhile, offering strong privacy preservation. This paper presents an algorithm to generate all the permutations, and studies the cardinality of the permutations based on the ring generalization. In addition, we prove that its cardinality is O(α\+n), α>1. Furthermore, we propose a semi-generalization algorithm which can meet the requirement of preserving anonymity of sensitive attributes in data sharing, and greatly reduce the amount of information loss resulting from data generalization for implementing data anonymization.