Home > Net >  C # save the children
C # save the children

Time:09-25

And try to be a randomly generated a to z method (five, were asked not to repeat), breakpoint test found that when the sj this array (sj is to return an array) is the assignment after the first time, the input is empty, and when he returned to the output will become digital, help children

CodePudding user response:

DDDDDDDDDDDDD

CodePudding user response:

The first figure to generate random five characters of it's not a big problem, the only change is the scope of the generated random number is (0, 26), as you write will appear index is out of range,
The second picture do you want? You want to output generated five characters, must finish all these five characters such as generating output again ah, take the last a for loop to return statements on a line,

CodePudding user response:

Put finally a for loop in your outside look at the second for loop

CodePudding user response:

 zf. OrderBy (x=& gt; Guid. NewGuid ()). Take (5) 

Don't repeat random take five finished

CodePudding user response:

young programmers reference 3 floor small don's reply:
put finally a for loop in your outside look at the second for loop

Not that last for loop is used for breakpoint test

CodePudding user response:

she would play the soy sauce reference 4 floor response:
 zf. OrderBy (x=& gt; Guid. NewGuid ()). Take (5) 

Don't repeat random take five completed

Without method, in order to practice creation method??????

CodePudding user response:

List List=new List () {" a ", "b", "c", "d", "e", "f", "g", "h" and "I" and "j", "k"};

List Result=new List (a);
for (int i=0; i <5; I++)
{
While (true)
{
The Random r=new Random ();
Int t=r.N ext (0, the list. The Count - 1);
if (! Result. The Contains (the list [t])
{
Result. The Add, list [t]);
break;
}
}
}

CodePudding user response:


Save the children is stem what! Watch it and you want to laugh!

CodePudding user response:

First of all, 'the assigned value for the first time, after the input are empty "on the back what you want to say, a word is not very good, the second,' after he returned to the output will become digital, you'd stick after he returned to the output that a piece of code out ah, the most in the end, you this naming variables and methods, let a person see the want to suddenly and violently dozen you,

CodePudding user response:

First:
 
/you/your child learn how to arrange your code backwardness to reply not to take photos with your mobile phone at the skull ache,

The second
 
//you can also add multiterminal code middle add words


You put your own code to move up again, the specific method is to post or reply to the window of the edit TAB under the "code" button icon, look at the mouse in the past,
  •  Tags:  
  • C #
  • Related