Getting Random values form a array string.

I'm tring to get the random values from an array list but can'

Page 1 of 1

4 Replies - 4955 Views - Last Post: 10 July 2009 - 11:00 PM Rate Topic: -----

#1 vir158   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-February 09

Getting Random values form a array string.

Post icon  Posted 12 February 2009 - 07:06 AM

I'm tring to get the random values from an array list but can't do it properly how can i do this
Is This A Good Question/Topic? 0
  • +

Replies To: Getting Random values form a array string.

#2 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1536
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Getting Random values form a array string.

Posted 12 February 2009 - 07:24 AM

show us the code that you have.
Was This Post Helpful? 0
  • +
  • -

#3 vir158   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-February 09

Re: Getting Random values form a array string.

Posted 13 February 2009 - 06:26 AM

Random Ques = new Random();
        
        for (int j = 0; j < i_noOfQues; j++)
        {
            abc[j] = str_Question[Ques.Next(0, str_Question.Length)];
        } 


in this strquestion is a array string.
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1536
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Getting Random values form a array string.

Posted 13 February 2009 - 06:31 AM

that looks like it would work. are you getting error messages? or does it just not work?
Was This Post Helpful? 0
  • +
  • -

#5 blackdots   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-July 09

Re: Getting Random values form a array string.

Posted 10 July 2009 - 11:00 PM

try like this:
abc[j] = str_Question[Ques.Next(0, str_Question.Length-1)];


lenght of array from 0 to lenght-1

This post has been edited by skyhawk133: 16 September 2010 - 05:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1