Click here to Skip to main content
15,887,322 members
Home / Discussions / C#
   

C#

 
QuestionEmbed an EXE in a frame within your program Pin
Goaty6510918-Apr-13 12:42
Goaty6510918-Apr-13 12:42 
AnswerRe: Embed an EXE in a frame within your program Pin
Dave Kreskowiak18-Apr-13 15:03
mveDave Kreskowiak18-Apr-13 15:03 
GeneralRe: Embed an EXE in a frame within your program Pin
Goaty6510918-Apr-13 17:00
Goaty6510918-Apr-13 17:00 
AnswerRe: Embed an EXE in a frame within your program Pin
DaveyM6918-Apr-13 19:44
professionalDaveyM6918-Apr-13 19:44 
GeneralRe: Embed an EXE in a frame within your program Pin
Dave Kreskowiak19-Apr-13 2:24
mveDave Kreskowiak19-Apr-13 2:24 
GeneralRe: Embed an EXE in a frame within your program Pin
Goaty6510919-Apr-13 4:14
Goaty6510919-Apr-13 4:14 
AnswerRe: Embed an EXE in a frame within your program Pin
Abhinav S18-Apr-13 21:10
Abhinav S18-Apr-13 21:10 
Questionhow can I run code dependent on a probability using a random object? Pin
raymond leadingham18-Apr-13 7:58
raymond leadingham18-Apr-13 7:58 
I have created a genetic algorithmic program, but when it comes to doing the crossover or mutation probability I am having to do this by hard coding the function. So My default crossover is a 70% chance of the method body running depending on the result of a random generation, I am using a random number between 1 and 10, storing 7 numbers in an array and checking if they are 8, 9 or 10 is selected then the method body does not run.

Here is my code:

C#
for (int i = 0; i < 7; i++)
     {
        pc[i] = random3.Next(1, 11);
     }

    int n = random3.Next(0, 7);

    if ((pc[n] != 8) && (pc[n] != 9) && (pc[n] != 10))
         {
            label58.Text = "YES!";

         }

          else
           {
              label58.Text = "NO!";
           }


I would like a better way to do this so I can choose a percentage probability by asking the user to enter a percentage. In real life the mutation probability is around 0.001, when it comes to this, I am having issues figuring out the best way to do this.

I would greatly appreciate your advice.
AnswerRe: how can I run code dependent on a probability using a random object? Pin
SledgeHammer0118-Apr-13 8:21
SledgeHammer0118-Apr-13 8:21 
GeneralRe: how can I run code dependent on a probability using a random object? Pin
raymond leadingham18-Apr-13 8:29
raymond leadingham18-Apr-13 8:29 
GeneralRe: how can I run code dependent on a probability using a random object? Pin
SledgeHammer0118-Apr-13 10:03
SledgeHammer0118-Apr-13 10:03 
AnswerRe: how can I run code dependent on a probability using a random object? Pin
dusty_dex18-Apr-13 9:00
dusty_dex18-Apr-13 9:00 
AnswerRe: how can I run code dependent on a probability using a random object? Pin
Jasmine250118-Apr-13 11:52
Jasmine250118-Apr-13 11:52 
Questionhow to change the shape of button in c# Pin
Nofar Gutman18-Apr-13 6:52
Nofar Gutman18-Apr-13 6:52 
AnswerRe: how to change the shape of button in c# Pin
SledgeHammer0118-Apr-13 8:22
SledgeHammer0118-Apr-13 8:22 
GeneralRe: how to change the shape of button in c# Pin
Nofar Gutman18-Apr-13 10:37
Nofar Gutman18-Apr-13 10:37 
AnswerRe: how to change the shape of button in c# Pin
Clifford Nelson18-Apr-13 17:02
Clifford Nelson18-Apr-13 17:02 
AnswerRe: how to change the shape of button in c# Pin
Eddy Vluggen18-Apr-13 10:00
professionalEddy Vluggen18-Apr-13 10:00 
GeneralRe: how to change the shape of button in c# Pin
Nofar Gutman18-Apr-13 10:35
Nofar Gutman18-Apr-13 10:35 
GeneralRe: how to change the shape of button in c# Pin
Eddy Vluggen18-Apr-13 10:46
professionalEddy Vluggen18-Apr-13 10:46 
AnswerRe: how to change the shape of button in c# Pin
Bernhard Hiller18-Apr-13 21:47
Bernhard Hiller18-Apr-13 21:47 
QuestionCapturing GPS data in C#.Net Pin
Sanjay K. Gupta18-Apr-13 3:12
professionalSanjay K. Gupta18-Apr-13 3:12 
SuggestionRe: Capturing GPS data in C#.Net Pin
Richard MacCutchan18-Apr-13 4:29
mveRichard MacCutchan18-Apr-13 4:29 
AnswerRe: Capturing GPS data in C#.Net Pin
Bernhard Hiller18-Apr-13 21:50
Bernhard Hiller18-Apr-13 21:50 
QuestionCount the unique number of words inside a string builder(Not letters...Words)) Pin
kanamala subin18-Apr-13 2:36
kanamala subin18-Apr-13 2:36 

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.