-
Using rand() to generate a random point in a 2d matrix
Location Matrix::randomAdjacentLocation(Location& location)
{ int row = location.getRow();
int col = location.getCol();
.
.
}
Above ‘location’ represents an occupied point in a two-dimensional matrix. How can I use row, col and rand() to generate a (random) point that is adjacent to ‘location’? If all adjacent points to ‘location’ are occupied, how can I get the function to look further afield, that is, how can I increment row and col non-uniformly? I would be very grateful for all help.
Similar Threads
-
By jrhaley123 in forum Java
Replies: 8
Last Post: 09-28-2013, 10:48 PM
-
By Ad van Klink in forum .NET
Replies: 1
Last Post: 09-01-2002, 08:52 AM
-
By ASPSmith Training in forum dotnet.announcements
Replies: 0
Last Post: 06-18-2002, 03:39 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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|