Click here to Skip to main content
15,900,258 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET Registry Creator Pin
Pete O'Hanlon21-Jan-15 9:47
mvePete O'Hanlon21-Jan-15 9:47 
AnswerRe: .NET Registry Creator Pin
Wendelius21-Jan-15 9:10
mentorWendelius21-Jan-15 9:10 
AnswerRe: .NET Registry Creator Pin
Mycroft Holmes21-Jan-15 20:47
professionalMycroft Holmes21-Jan-15 20:47 
AnswerRe: .NET Registry Creator Pin
Bernhard Hiller22-Jan-15 0:58
Bernhard Hiller22-Jan-15 0:58 
QuestionCoding help Pin
Member 1139217221-Jan-15 7:04
Member 1139217221-Jan-15 7:04 
AnswerRe: Coding help Pin
Wendelius21-Jan-15 7:19
mentorWendelius21-Jan-15 7:19 
GeneralRe: Coding help Pin
Member 1139217221-Jan-15 7:43
Member 1139217221-Jan-15 7:43 
GeneralRe: Coding help Pin
Pete O'Hanlon21-Jan-15 9:06
mvePete O'Hanlon21-Jan-15 9:06 
Well, the actual rolling of the dice involves a random number generator. What you want to do is to instantiate an instance of the Math.Random class, and use this as the base of your rolls. You want to do this away from the code that actually gets the numbers because you don't want to create a new instance each time. An example of this might be:
C#
public sealed class Dice
{
  private Random random = new Random();

  public List<int> DiceRolls(int count)
  {
    List<int> rolls = new List<int>();
    for (int i = 0; i < count; i++)
    {
       rolls.Add(random.Next(1,7));
    }
    return rolls;
  }
}
We do this because Random uses the system time to generate what's called a seed number. Now, if we had the instantiation of random inside the loop, chances are that you would be entering the same seed value at least some of the time.
QuestionDeserialize Parts of an XML Pin
Antonio Cambule20-Jan-15 22:32
Antonio Cambule20-Jan-15 22:32 
AnswerRe: Deserialize Parts of an XML Pin
Daniel Pfeffer20-Jan-15 22:55
professionalDaniel Pfeffer20-Jan-15 22:55 
GeneralRe: Deserialize Parts of an XML Pin
Antonio Cambule20-Jan-15 23:13
Antonio Cambule20-Jan-15 23:13 
GeneralRe: Deserialize Parts of an XML Pin
Daniel Pfeffer21-Jan-15 0:40
professionalDaniel Pfeffer21-Jan-15 0:40 
GeneralRe: Deserialize Parts of an XML Pin
Antonio Cambule21-Jan-15 0:56
Antonio Cambule21-Jan-15 0:56 
GeneralRe: Deserialize Parts of an XML Pin
Daniel Pfeffer21-Jan-15 2:51
professionalDaniel Pfeffer21-Jan-15 2:51 
AnswerRe: Deserialize Parts of an XML Pin
Gerry Schmitz21-Jan-15 13:00
mveGerry Schmitz21-Jan-15 13:00 
QuestionIE 11 Registry Entries Pin
namerg20-Jan-15 11:43
namerg20-Jan-15 11:43 
AnswerRe: IE 11 Registry Entries Pin
Pete O'Hanlon20-Jan-15 11:50
mvePete O'Hanlon20-Jan-15 11:50 
GeneralRe: IE 11 Registry Entries Pin
namerg20-Jan-15 11:57
namerg20-Jan-15 11:57 
GeneralRe: IE 11 Registry Entries Pin
Pete O'Hanlon20-Jan-15 12:14
mvePete O'Hanlon20-Jan-15 12:14 
GeneralRe: IE 11 Registry Entries Pin
namerg20-Jan-15 14:13
namerg20-Jan-15 14:13 
QuestionHex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 2:04
NJdotnetdev20-Jan-15 2:04 
AnswerRe: Hex to UUEncode in C# Pin
OriginalGriff20-Jan-15 2:50
mveOriginalGriff20-Jan-15 2:50 
GeneralRe: Hex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 3:24
NJdotnetdev20-Jan-15 3:24 
GeneralRe: Hex to UUEncode in C# Pin
OriginalGriff20-Jan-15 3:35
mveOriginalGriff20-Jan-15 3:35 
GeneralRe: Hex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 3:43
NJdotnetdev20-Jan-15 3:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.