Generates a new unique identifier - CSharp System.Security.Cryptography

CSharp examples for System.Security.Cryptography:MD5

Description

Generates a new unique identifier

Demo Code

/*Copyright Message//  ww  w.j a  va  2s  . co  m
* XBundle
* Copyright ? 2012 ambax Software UG (haftungsbeschr?nkt)
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*
* @category  XBundle
* @copyright  Copyright (c) 2014, ambax Software UG (http://www.ambax.de)
* @author ambax Software UG
*/
using System;

public class Main{
        /// <summary>
        ///     Generates a new unique identifier
        /// </summary>
        /// <returns></returns>
        public static uint GenerateUid()
        {
            var rnd = new Random();
            return (uint) rnd.Next(0, int.MaxValue);
        }
}

Related Tutorials