Notifications
                
            
                Clear all
    
            
        [Closed] Random Selection – Need Unique Array
                
                    Page 2 / 2                
				                    
                         Prev                    
				                
				            
        Dec 22, 2010 6:44 pm
                      
if percent < 100.0 then
(
	faces = node.verts as bitarray as array
	sel = #{}
	num = (faces.count as float)*percent/100.0
	for k=1 to num do
	(
		id = random 1 faces.count
		sel[faces[id]] = on
		deleteitem faces id
	)
	node.selectedfaces = sel    
)
else node.selectedfaces = node.faces
if percent is more than 50 it’s faster to collect faces to deselect…
Dec 22, 2010 6:44 pm
                      Hi Videep,
while (firstArray.count<b and firstArray.count<a) do
–> firstArray.count<b: check for enough percentage of faces or not
–> firstArray.count<a: check for reaching maximum of faces
Hi denisT,
I understand what you meant, I just made it as fast as I can. I’m sure that is completely right.
But that algorithm didn’t optimize, so it will become very slow for big amount of faces. Anyway, thanks for you comments, I think it’s really helpful for Videep, because he’s new with maxscript and programming 
                
                    Page 2 / 2                
				                    
                         Prev