Results 1 to 2 of 2
  1. #1
    dredd is offline Member
    Join Date
    Mar 2013
    Posts
    11
    Rep Power
    0

    Default How can I pick random indices of a matrix with a constraints?

    I want to create a matrix like this one:

    0000000000
    0101110000
    1111100000
    0110100000
    0010000000
    0000000000

    that is to say I want to randomly to pick indices for the second row to put 1's in a fixed number of cells, and I want that from the third row to put 1's in each cell but I have to allow a clear path of 1's from the third row to the second row (and it's also needs to be randomly - the pick of the indices in the third row) - any suggestions?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,001
    Blog Entries
    7
    Rep Power
    20

    Default Re: How can I pick random indices of a matrix with a constraints?

    I posted a reply in your other thread: How can I create a get method to return a matrix reference?, don't ignore replies.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 2
    Last Post: 03-08-2013, 05:48 PM
  2. Pick a random value from array?
    By RattleSnake in forum New To Java
    Replies: 2
    Last Post: 04-26-2011, 05:36 AM
  3. Pick random array index and change the element value
    By Space Ranger in forum New To Java
    Replies: 8
    Last Post: 03-29-2011, 10:18 PM
  4. How to: Select specific array indices?
    By louist in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 10:21 PM
  5. DnD - JList indices
    By carderne in forum New To Java
    Replies: 0
    Last Post: 03-09-2009, 06:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •