Dynamic e random matrix

Hello, I'm developing an app for Mac, Xcode 15.1, with Swift 5. I need to create a visual matrix, whose elements will be filled randomly, according to the choices the user makes. The matrix must have 10 columns and 40 rows. Does anyone know a component, or how to fill it dynamically and randomly? Thanks.

Replies

Could you explain clearly what you want to do ?

What is random ?

  • the cell (col*row) selection ?

If so, you just have to select a random (1 to 10) for col and 1 to 40 for row. If cell is already filled, select another one.

  • the content of each cell ? Filled with what ? value ? Text ?

Select a content randomly

  • what do you mean exactly by dynamically ?

Claude31,

Exactly.

In the application, the user will answer some questions and according to their answer, a certain column X row will be filled with information.

Like this:

  1. The cell (col X row) to be filled depends on the user's response

  2. The content will be text, a string.

  3. You can restart the app at any time, when previously used cells must be cleaned.