<commit_before>package org.xcolab.portlets.contests;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ext.portlet.model.Contest;
import com.ext.portlet.service.ContestLocalServiceUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.theme.ThemeDisplay;

public class ContestsBean implements Serializable {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public List<ContestWrapper> getContests() throws SystemException, PortalException {
        List<ContestWrapper> ret = new ArrayList<>();
        
        for (Contest contest: ContestLocalServiceUtil.findByActiveFlagText(true, "Open")) {
            ret.add(new ContestWrapper(contest));
        }
        return ret;
    }
    
    public ThemeDisplay getThemeDisplay() {
        return Helper.getThemeDisplay();
    }
    
}<commit_msg>randomize order and only display 2<commit_after>package org.xcolab.portlets.contests;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ext.portlet.model.Contest;
import com.ext.portlet.service.ContestLocalServiceUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.theme.ThemeDisplay;

public class ContestsBean implements Serializable {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
    private static final int NUM_CONTESTS = 2;
	
	public List<ContestWrapper> getContests() throws SystemException, PortalException {
        List<ContestWrapper> ret = new ArrayList<>();

        List<Contest> contests = ContestLocalServiceUtil.findByActiveFlagText(true, "");
        Collections.shuffle(contests);

        for (Contest contest: contests) {
            if(ret.size() < NUM_CONTESTS)
                ret.add(new ContestWrapper(contest));
            else break;
        }
        return ret;
    }
    
    public ThemeDisplay getThemeDisplay() {
        return Helper.getThemeDisplay();
    }
    
}
{'fraction_non_alphanumeric': 0.09684392563769996, 'fraction_numerical': 0.0017293558149589277, 'mean_word_length': 3.6095617529880477, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3232677', 'n_tokens_mistral': 677, 'n_tokens_neox': 669, 'n_words': 134}