LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Test Random

Hello to all
I would like a vi that opens the source file, in txt format for the moment, and generates a number of random copies.
Entering the number of questions and the number of answers I divided the questions and now I would like to assign them a random position in a array but the result isn't I want.
Do you have any advice?

 

Download All
0 Kudos
Message 1 of 11
(2,702 Views)

@franbecks wrote:

Entering the number of questions and the number of answers I divided the questions and now I would like to assign them a random position in a array but the result isn't I want.


What is the result that you want? 

0 Kudos
Message 2 of 11
(2,683 Views)

I would the vi puts the question 1 (domanda 1), it has intial  position 1, in a random position.

And I would repeat for all questions.

When I finished with the question I want randomize the answer, but this is another step.

0 Kudos
Message 3 of 11
(2,665 Views)

I think that you don't want completely random, though. I'm guessing that you want to put question 1 in a random position, and then put question 2 randomly in one of the 3 remaining positions, and then put question 3 randomly in one of the 2 remaining positions, and then put question 4 in the final remaining position. Is this correct?

0 Kudos
Message 4 of 11
(2,650 Views)

To get a row, use index array, not "delete from array".

What's the point of the numeric control?

In newer LabVIEW versions, you can use "shuffle 1D array", but you could easily write your own.

 

altenbach_0-1584557636774.png

 

0 Kudos
Message 5 of 11
(2,640 Views)

@johntrich1971  ha scritto:

I think that you don't want completely random, though. I'm guessing that you want to put question 1 in a random position, and then put question 2 randomly in one of the 3 remaining positions, and then put question 3 randomly in one of the 2 remaining positions, and then put question 4 in the final remaining position. Is this correct?


Yes, it's correct. 

I generate a random pseudo position, this test has only 4 questions but I want the vi woks with a lot of questions.

I have changed, to extract the questions, delete array with index array to separate the questions and I use index array but doesn't work like I would.

Can you explain me why?

0 Kudos
Message 6 of 11
(2,565 Views)

In the attached the first loop pulls the questions and the second loop randomizes them. Altenbach's suggestion to use Shuffle 1D Array is a better solution than the second loop, but I did the exercise to show you one way it could be done. 

 

One suggestion that I would have is to go ahead and group your question and answers in the first loop (perhaps with a cluster containing a question and an array of answers). This will more readily allow you to put the in the proper order later.

0 Kudos
Message 7 of 11
(2,545 Views)

@johntrich1971  ha scritto:

In the attached the first loop pulls the questions and the second loop randomizes them. Altenbach's suggestion to use Shuffle 1D Array is a better solution than the second loop, but I did the exercise to show you one way it could be done. 

 

One suggestion that I would have is to go ahead and group your question and answers in the first loop (perhaps with a cluster containing a question and an array of answers). This will more readily allow you to put the in the proper order later.


Thank you, but there is a problem with you attached.

Please, you can send me.

franbecks_0-1584654771613.png

 

0 Kudos
Message 8 of 11
(2,517 Views)

Is the filename pointing correctly to your text file? 

0 Kudos
Message 9 of 11
(2,508 Views)

When I open the vi it searchs some library.

franbecks_0-1584658814359.png

 and when it doesn't found sends this pop up.

franbecks_1-1584658879479.png

So,I open and modify the directory.

0 Kudos
Message 10 of 11
(2,502 Views)