What is the function of while (true) in a general loop

is a random number from 1 to 37 that outputs seven numbers.
the result of the two pieces of code is the same.
I would like to ask what role while (true) plays.

class Rnd_36_7
{
    public static void main(String[] args)
    {
        int a[] = new int[7];
        for( int i=0;i<a.length;iPP)
        {
            one_num:
            while(true)
            {
                a[i] = (int)( Math.random()*36 ) +1;

                for( int j=0;j<i;jPP ){ 
                    if( a[i]==a[j] ) continue one_num;
                }
                break;
            }
        }
        for( int num: a) System.out.print( num+" " ); 
        System.out.println();
    }
}
package j36_7;

public class Java36_7 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int []a = new int[7];
        for(int i= 0; i < a.length;iPP)
        {
//            loop:
//            while(true)    
//            {
                a[i]=(int)(Math.random()*36)+1;
                loop:
                for(int j=0;j<i;jPP)
                {
                    if(a[i]==a[j])
                    {
                        continue loop;
                    }
                }
//            break;
//            }
        }
        for(int num : a)
        {
            System.out.print(num+" ");
        }
    }

}
Aug.19,2021
The

infinite loop does not exit the loop until break is called


to ensure execution


for example, write a thread, while (true) {}, and add sleep (), to the thread to make a scheduled task that executes the contents of the thread every sleep.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3af0d-2b5b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3af0d-2b5b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?