Lars Dammann
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                6 years ago                            
                            
                                Jan 30, 2020, 11:06 a.m. EST                            
                        
                        
                                                    Hi, I think you mean to use java.util.Random, is that right? The Application Builder does not manage imports automatically, so you will have to go to the preferences, in the tab "Methods" and activate the option "view all code". With that, you will find some extra code around each method, which shows that a COMSOL method is actually a Java class. At the top, there are imports for some classes by default. If you add java.util.Random to those imports, your code should work.
Alternatively you can refer to random by its full name "java.util.Random" instead of just "Random" everywhere you use it in the code, which also works.
Best wishes,
Lars
                                                 
                                                
                            Hi, I think you mean to use java.util.Random, is that right? The Application Builder does not manage imports automatically, so you will have to go to the preferences, in the tab "Methods" and activate the option "view all code". With that, you will find some extra code around each method, which shows that a COMSOL method is actually a Java class. At the top, there are imports for some classes by default. If you add java.util.Random to those imports, your code should work.
Alternatively you can refer to random by its full name "java.util.Random" instead of just "Random" everywhere you use it in the code, which also works.
Best wishes,
Lars                        
                                                
                                                                                                            
                                             
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                6 years ago                            
                            
                                Jan 30, 2020, 11:11 a.m. EST                            
                        
                        
                                                    Heh, I found the solution of question :) It needed to click File -> Preferences -> Methods and check the flag in "View all code".
                                                 
                                                
                            Heh, I found the solution of question :) It needed to click File -> Preferences -> Methods and check the flag in "View all code".