/*
 * © 2013-2019 by Zappware. 
 * All Rights Reserved. No part of this application or any of its contents may be reproduced, 
 * copied, modified or adapted, without the prior written consent of Zappware.
 *
 * Website: http://www.zappware.com
 * E-Mail: info@zappware.com
 */
package com.zappware.graphlperftest.processing;

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

import org.apache.commons.lang3.RandomStringUtils;

/**
 * Generator of CPU load.
 */
public class CPULoadGenerator
{
	/** A list with random strings. */
	private List<String> randomList = new ArrayList<>();
	
	/**
	 * Set the size of the list that will be used to simulate the generation of CPU load.
	 * @param loadSize
	 */
	public void setLoadSize(int loadSize)
	{
		randomList.clear();
		for (int i = 0; i < loadSize; i++)
			randomList.add(RandomStringUtils.randomAlphanumeric(25));
	}
	
	/**
	 * Generate some load.
	 */
	public void generateLoad()
	{
		if (!randomList.isEmpty())
		{
			List<String> listClone = new ArrayList<>(randomList);
			Collections.shuffle(listClone);
			Collections.sort(listClone);
		}
	}
}