Posted By

krisdb on 02/25/09


Tagged

c-sharp


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

enajenkins
umang_nine
ddevening
rodrigojuarez


Random Number


 / Published in: C#
 

  1. Random rdm = new Random();
  2.  
  3. int random = rdm.Next(3);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: dzr_gregory on October 5, 2010

Shorter:

int value = new Random().Next(3);

You need to login to post a comment.