fork download
  1. using System;
  2.  
  3. public class Test {
  4. static Random MyRand = new Random ();
  5. static int rand () { return MyRand.Next (1, 10); }
  6.  
  7. public static void Main () {
  8. int [] arr = new int [6];
  9. for (int i=0; i<6; i++) {
  10. arr [i] = rand ();
  11. for (int j=0; j<i; j++) {
  12. if (arr [i] == arr [j]) i--;
  13. }
  14. }
  15. for (int i=0; i<6; i++) Console.Write (arr [i] + " ");
  16. }
  17. }
Success #stdin #stdout 0.02s 14868KB
stdin
Standard input is empty
stdout
1 8 5 6 2 7