Click here to Skip to main content
15,899,475 members
Home / Discussions / C#
   

C#

 
GeneralRe: Random.next(min,max) Pin
PIEBALDconsult9-Apr-10 3:34
mvePIEBALDconsult9-Apr-10 3:34 
GeneralRe: Random.next(min,max) Pin
Luc Pattyn9-Apr-10 1:56
sitebuilderLuc Pattyn9-Apr-10 1:56 
GeneralRe: Random.next(min,max) Pin
David Skelly9-Apr-10 2:29
David Skelly9-Apr-10 2:29 
GeneralRe: Random.next(min,max) [modified] Pin
igalep1329-Apr-10 2:42
igalep1329-Apr-10 2:42 
GeneralRe: Random.next(min,max) Pin
David Skelly9-Apr-10 2:57
David Skelly9-Apr-10 2:57 
GeneralRe: Random.next(min,max) Pin
igalep1329-Apr-10 5:36
igalep1329-Apr-10 5:36 
AnswerRe: Random.next(min,max) Pin
Luc Pattyn9-Apr-10 2:18
sitebuilderLuc Pattyn9-Apr-10 2:18 
AnswerRe: Random.next(min,max) Pin
riced9-Apr-10 2:22
riced9-Apr-10 2:22 
Not sure what your problem is - it works as expected for me and as Luc says (and he's not often wrong - if ever. Smile | :) )
Here's a little console app that does what I think you're doing.
Note the bogus variables - you can adjust them to see what happens.
(Gets rid of unnecessary flag but logic is the same. Smile | :) )

using System;
using System.Linq;

namespace ConsoleApplication1
{
   class Program
   {
      static void Main(string[] args)
      {
         Tester();
         Console.ReadLine();
      }
      public static void Tester()
      {
         //Bogus variables to emulate code
         int[] zeroFrequencyLetterList = { 1, 2, 3, 4, 0, 5, 10, 9, 8, 7, 6, 5, 10, 2, 9, 7, 0, 6 };
         int decrypted = 0;
         char[] encryptionKey = { 'a', 'b', ' ', 'c', 'd', 'e', ' ', ' ', 'f', ' ', 'g' };

         Random r = new Random();
         for (int i = 0; i < zeroFrequencyLetterList.Count() && decrypted < 25; i++)
         {
            int randomed;
            char aLetter;
            do
            {
               randomed = r.Next(0, zeroFrequencyLetterList.Count());
               aLetter = encryptionKey[zeroFrequencyLetterList[randomed]];
               Console.WriteLine("{0,3}: {1,3} -> {2}", i, randomed, aLetter ); 
            } while (aLetter == ' ');

            //    encryptionKey[zeroFrequencyLetterList[i]] = abcLetters[randomed];
            //    abcLetters.RemoveAt(randomed);
            //    zeroFrequencyLetterList.RemoveAt(i);
            decrypted++;
         }
      }
   }
}

Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.

GeneralRe: Random.next(min,max) Pin
David Skelly9-Apr-10 2:34
David Skelly9-Apr-10 2:34 
GeneralRe: Random.next(min,max) Pin
ragnaroknrol9-Apr-10 6:18
ragnaroknrol9-Apr-10 6:18 
GeneralRe: Random.next(min,max) Pin
Luc Pattyn9-Apr-10 2:39
sitebuilderLuc Pattyn9-Apr-10 2:39 
Questioncopi image from picturebox to scalablepicturebox control Pin
aasif aslam9-Apr-10 0:07
aasif aslam9-Apr-10 0:07 
AnswerRe: copi image from picturebox to scalablepicturebox control Pin
OriginalGriff9-Apr-10 0:26
mveOriginalGriff9-Apr-10 0:26 
QuestionHow to filter two columns in bindingsource Pin
crisjala8-Apr-10 23:44
crisjala8-Apr-10 23:44 
AnswerRe: How to filter two columns in bindingsource Pin
OriginalGriff9-Apr-10 0:04
mveOriginalGriff9-Apr-10 0:04 
QuestionAbout the Pop3 Pin
Omkaar8-Apr-10 23:42
Omkaar8-Apr-10 23:42 
AnswerRe: About the Pop3 Pin
OriginalGriff9-Apr-10 0:06
mveOriginalGriff9-Apr-10 0:06 
AnswerRe: About the Pop3 Pin
yu-jian9-Apr-10 2:24
yu-jian9-Apr-10 2:24 
Questionsouth african phone number validation Pin
Morgs Morgan8-Apr-10 23:01
Morgs Morgan8-Apr-10 23:01 
AnswerRe: south african phone number validation Pin
Keith Barrow8-Apr-10 23:11
professionalKeith Barrow8-Apr-10 23:11 
GeneralRe: south african phone number validation Pin
Morgs Morgan8-Apr-10 23:38
Morgs Morgan8-Apr-10 23:38 
AnswerRe: south african phone number validation Pin
OriginalGriff8-Apr-10 23:23
mveOriginalGriff8-Apr-10 23:23 
GeneralRe: south african phone number validation Pin
Morgs Morgan8-Apr-10 23:37
Morgs Morgan8-Apr-10 23:37 
GeneralRe: south african phone number validation Pin
Morgs Morgan9-Apr-10 0:19
Morgs Morgan9-Apr-10 0:19 
GeneralRe: south african phone number validation Pin
OriginalGriff9-Apr-10 0:28
mveOriginalGriff9-Apr-10 0:28 

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.