You have three main problems.
1. You while statement is wrong. In C, a single = is an assignment. == is an equivalence test. Your statement while (v=1) always assigns a value of 1 to v. That is an endless loop. while (v==1) will run as long as v equals 1.
2. v is not initialized. After you correct the while to while (v==1), the first time into the loop, v does not have an assigned value. You could set v=1 prior to the loop or you could use a do while loop (which tests the condition at the end of each loop iteration) instead of a while loop (which tests the condition at the start of each loop iteration).
3. Your loop is before the RunUserInterface statement, so CVI is not running the user interface, so it doesn't see you trying to operate the switch to stop the lo
op. You could do something like the following:
3.1 Make the On-Off switch default to Off.
3.2 Create a callback function for the On-Off switch. (In the UI Editor, double-clock on the On-Off switch to edit the control, enter a callback function name, click OK, then right-click on the control and select Generate Control Callback).
3.3 Move your loop to create your random numbers to the EVENT_COMMIT case in the callback. Like you tried to do initially, stop the loop when On-Off goes False.