Java Code Examples for java.util.Collections.shuffle()

The following are Jave code examples for showing how to use shuffle() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ABM-adaptive-tolerance   File: Simulation.java   View Source Code Vote up 6 votes
/**
 * Method to generate a set of w unique numbers designed to help agents
 * chose random empty tiles
 **/
public int[] generateUniqueNumbers(int w)
{
	if (w > emptyTiles.size())
	{
		w = emptyTiles.size();
		// print("<<generateUniqueNumbers>> w is " + w + ", but empty Tiles remaining are " +
		// emptyTiles.size() + ". w = " + emptyTiles.size());
	}
	ArrayList<Integer> list = new ArrayList<Integer>();
	int[] listOfW = new int[w];
	for (int i = 0; i < emptyTiles.size(); i++)
	{
		list.add(new Integer(i));
	}
	Collections.shuffle(list, new Random(System.nanoTime()));

	for (int i = 0; i < w; i++)
	{
		listOfW[i] = list.get(i);
	}

	return listOfW;
}
 
Example 2
Project: clearwsd   File: CrossValidation.java   View Source Code Vote up 6 votes
public List<Fold<T>> createFolds(List<T> instances, int numFolds) {
    Collections.shuffle(instances, random);
    Preconditions.checkArgument(instances.size() >= numFolds * 2, "K-fold cross-validation"
            + " requires at least 2*K instances.");

    Iterator<T> iterator = instances.iterator();
    List<List<T>> folds = IntStream.range(0, numFolds)
            .mapToObj(i -> new ArrayList<T>())
            .collect(Collectors.toList());
    int index = 0;
    while (iterator.hasNext()) {
        folds.get(index % numFolds).add(iterator.next());
        ++index;
    }

    List<Fold<T>> result = new ArrayList<>();
    for (index = 0; index < numFolds; ++index) {
        int foldNumber = index;
        List<T> train = IntStream.range(0, numFolds)
                .filter(fold -> fold != foldNumber)
                .mapToObj(folds::get).flatMap(List::stream).collect(Collectors.toList());
        result.add(new Fold<>(train, folds.get(foldNumber)));
    }
    return result;
}
 
Example 3
Project: SimpleUILauncher   File: ShortcutFilterTest.java   View Source Code Vote up 6 votes
private void filterShortcutsAndAssertNumStaticAndDynamic(
        List<ShortcutInfoCompat> shortcuts, int expectedStatic, int expectedDynamic) {
    Collections.shuffle(shortcuts);
    List<ShortcutInfoCompat> filteredShortcuts = ShortcutFilter.sortAndFilterShortcuts(shortcuts);
    assertIsSorted(filteredShortcuts);

    int numStatic = 0;
    int numDynamic = 0;
    for (ShortcutInfoCompat shortcut : filteredShortcuts) {
        if (shortcut.isDeclaredInManifest()) {
            numStatic++;
        }
        if (shortcut.isDynamic()) {
            numDynamic++;
        }
    }
    assertEquals(expectedStatic, numStatic);
    assertEquals(expectedDynamic, numDynamic);
}
 
Example 4
Project: googles-monorepo-demo   File: AsciiBenchmark.java   View Source Code Vote up 6 votes
@BeforeExperiment void setUp() {
  random = new Random(0xdeadbeef);  // fix the seed so results are comparable across runs

  int nonAlpha = size / nonAlphaRatio;
  int alpha = size - nonAlpha;

  List<Character> chars = Lists.newArrayListWithCapacity(size);
  for (int i = 0; i < alpha; i++) {
    chars.add(randomAlpha());
  }
  for (int i = 0; i < nonAlpha; i++) {
    chars.add(randomNonAlpha());
  }
  Collections.shuffle(chars, random);
  char[] array = Chars.toArray(chars);
  this.testString = new String(array);
}
 
Example 5
Project: googles-monorepo-demo   File: EnumsBenchmark.java   View Source Code Vote up 5 votes
@BeforeExperiment
@SuppressWarnings("unchecked")
void setUp() throws ClassNotFoundException {
  Preconditions.checkArgument(hitRate >= 0 && hitRate <= 1,
      "hitRate must be in the range [0,1]");

  enumType = (Class<? extends Enum>)
      Class.forName(EnumsBenchmark.class.getCanonicalName() + "$" + enumSize + "Enum");

  Enum<?>[] allConstants = enumType.getEnumConstants();
  List<String> hits = new ArrayList<String>();
  for (int i = 0; i < hitRate * 256 / 3; ++i) {
    hits.add(allConstants[0].name());
    hits.add(allConstants[allConstants.length / 2].name());
    hits.add(allConstants[allConstants.length - 1].name());
  }

  List<String> misses = new ArrayList<String>();
  for (int i = 0; i < 256 - hits.size(); ++i) {
    misses.add("INVALID");
  }

  List<String> sampleDataList = new ArrayList<String>();
  sampleDataList.addAll(hits);
  sampleDataList.addAll(misses);
  Collections.shuffle(sampleDataList);
  sampleData = sampleDataList.toArray(new String[sampleDataList.size()]);
}
 
Example 6
Project: RedisClusterManager   File: AssignHelp.java   View Source Code Vote up 5 votes
/**
 * 根据host分组
 */
private Map<String,Set<Integer>> getHostGroup(List<HostAndPort> list){
	Map<String,Set<Integer>> hosts = new HashMap<String, Set<Integer>>();
	Collections.shuffle(list);
	for (HostAndPort ipPort : list) {
		Set<Integer> ports = hosts.get(ipPort.getHost());
		if(ports == null){
			ports = new HashSet<Integer>();
		}
		ports.add(ipPort.getPort());
		hosts.put(ipPort.getHost(), ports);
	}
	return hosts;
}
 
Example 7
Project: elasticsearch_my   File: TransportNodesActionTests.java   View Source Code Vote up 5 votes
public void testNewResponse() {
    TestTransportNodesAction action = getTestTransportNodesAction();
    TestNodesRequest request = new TestNodesRequest();
    List<TestNodeResponse> expectedNodeResponses = mockList(TestNodeResponse::new, randomIntBetween(0, 2));
    expectedNodeResponses.add(new TestNodeResponse());
    List<BaseNodeResponse> nodeResponses = new ArrayList<>(expectedNodeResponses);
    // This should be ignored:
    nodeResponses.add(new OtherNodeResponse());
    List<FailedNodeException> failures = mockList(
        () -> new FailedNodeException(
            randomAsciiOfLength(8),
            randomAsciiOfLength(8),
            new IllegalStateException(randomAsciiOfLength(8))),
        randomIntBetween(0, 2));

    List<Object> allResponses = new ArrayList<>(expectedNodeResponses);
    allResponses.addAll(failures);

    Collections.shuffle(allResponses, random());

    AtomicReferenceArray<?> atomicArray = new AtomicReferenceArray<>(allResponses.toArray());

    TestNodesResponse response = action.newResponse(request, atomicArray);

    assertSame(request, response.request);
    // note: I shuffled the overall list, so it's not possible to guarantee that it's in the right order
    assertTrue(expectedNodeResponses.containsAll(response.getNodes()));
    assertTrue(failures.containsAll(response.failures()));
}
 
Example 8
Project: Progetto-M   File: GeneratoreTorneo.java   View Source Code Vote up 5 votes
public void eliminazioneDiretta(String nomeTorneo, List<Squadra> squadre, List<Arbitro> arbitri){
    
    int sizeSquadre = squadre.size();
    if((sizeSquadre & (sizeSquadre - 1)) == 0){
        int sizeArbitri = arbitri.size();
        int k = 1;
    
        Integer[] indexSquadre = new Integer[sizeSquadre];
        for (int i = 0; i < indexSquadre.length; i++) {
            indexSquadre[i] = i;
        }
    
        Integer[] indexArbitri = new Integer[sizeArbitri];
        for (int i = 0; i < indexArbitri.length; i++) {
            indexArbitri[i] = i;
        }
        Collections.shuffle(Arrays.asList(indexSquadre));
        for(int i = 0; i < sizeSquadre; i += 2){
            Collections.shuffle(Arrays.asList(indexArbitri));
            int j = 0;
            partite.add(new Partita(k, squadre.get(indexSquadre[i]), squadre.get(indexSquadre[i+1]), arbitri.get(indexArbitri[j]), squadre.get(indexSquadre[i]).getCittaProvenienza(), StatoPartita.PROGRAMMATA));
            j++;
            k++;
            partite.add(new Partita(k, squadre.get(indexSquadre[i+1]), squadre.get(indexSquadre[i]), arbitri.get(indexArbitri[j]), squadre.get(indexSquadre[i+1]).getCittaProvenienza(), StatoPartita.PROGRAMMATA));
            j++;
            k++;
        }
    
        //for solo per controllare se funziona
        for(int i = 0; i<partite.size(); i++){
            System.out.println(partite.get(i).getSquadraCasa().getNome() + " " + partite.get(i).getSquadraOspite().getNome());
        }
    
        torneo = new EliminazioneDiretta(nomeTorneo, partite);
        tornei.add(torneo);
    } else {
        System.out.println("Mi dispiace, non è possibile creare un torneo ad eliminazione diretta, serve che il numero delle squadre sia una potenza di due");
    }
}
 
Example 9
Project: cactoos   File: Shuffled.java   View Source Code Vote up 5 votes
/**
 * Ctor.
 * @param iterator The original iterator
 */
public Shuffled(final Iterator<T> iterator) {
    this.scalar = new UncheckedScalar<>(
        new StickyScalar<>(
            () -> {
                final List<T> items = new LinkedList<>();
                while (iterator.hasNext()) {
                    items.add(iterator.next());
                }
                Collections.shuffle(items);
                return items.iterator();
            }
        )
    );
}
 
Example 10
Project: calendar-based-microsim   File: Employments.java   View Source Code Vote up 5 votes
/**
 * 
 */
public static void updateEmploymentStatusBasedOnJobChange(double deltaJob, int iYear) {
	double percentLiveInWorkIn = (double)Population.getInitLiveInWorkIn()/((double)Population.getInitLiveInWorkIn() + (double)Population.getInitLiveOutWorkIn());
	double percentLiveOutWorkIn = 1 - percentLiveInWorkIn;
	
	if (deltaJob<0) {
		int lostJobsLiveInWorkIn = (int)(deltaJob*percentLiveInWorkIn);
		int lostJobsLiveOutWorkIn = (int)(deltaJob*percentLiveOutWorkIn);
		
		// updates the number of people commuting into the region for work
		int newPeopleLiveOutWorkIn = Math.max(0, Population.getCrnLiveOutWorkIn() + lostJobsLiveOutWorkIn);
		Population.setCrnLiveOutWorkIn(newPeopleLiveOutWorkIn);
		
		// gets ID of employed individuals working in the region and shuffle them
		ArrayList<Integer> employedIndivID = PopulationAnalytics.getIDIndivs(EmploymentStatus.employed, PlaceOfWork.in);
		Collections.shuffle(employedIndivID,HardcodedData.random);
		// changes deltaJobsLiveInWorkIn people from employed to unEmployed or nonLabour (if the individual is older than retired age)
		for (int i=0; i<=Math.abs(lostJobsLiveInWorkIn)-1; i++) {
			Integer selID = employedIndivID.get(i);
			if (Population.getIndivPool().get(selID).getAge()>=HardcodedData.retiredAge) {
				Population.getIndivPool().get(selID).setEmpStat(EmploymentStatus.nonLabour);
			} else {
				Population.getIndivPool().get(selID).setEmpStat(EmploymentStatus.unEmployed);
			}
			// set workplace to null for this individual;
			Population.getIndivPool().get(selID).setWorkPlace(null);
		}
		
	} else {
		//handleNewJobs_v1(deltaJob, percentLiveInWorkIn, percentLiveOutWorkIn, iYear);
		handleNewJobs_v2(deltaJob, percentLiveInWorkIn, percentLiveOutWorkIn, iYear);
	}
}
 
Example 11
Project: GitHub   File: CountriesAsyncLoader.java   View Source Code Vote up 5 votes
@Override protected List<Country> doInBackground(Void... params) {

    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) {
      return null;
    }

    List<Country> countries = CountryApi.getCountries();
    Collections.shuffle(countries);

    return countries;
  }
 
Example 12
Project: argument-reasoning-comprehension-task   File: Step8aTaskValidationHITCreator.java   View Source Code Vote up 5 votes
@Override
protected void process(ReasonClaimWarrantContainer reasonClaimWarrantContainer)
{
    MTurkHITContainerReasonClaimWarrantOriginal.HITReasonClaimWarrantOriginalValidation reasonClaimWarrant
            = new MTurkHITContainerReasonClaimWarrantOriginal.HITReasonClaimWarrantOriginalValidation(
            reasonClaimWarrantContainer.getDebateMetaData().getTitle(),
            reasonClaimWarrantContainer.getDebateMetaData().getDescription(),
            reasonClaimWarrantContainer.getReasonClaimWarrantId(),
            reasonClaimWarrantContainer.getAnnotatedStance(),
            reasonClaimWarrantContainer.getAlternativeWarrant(),
            reasonClaimWarrantContainer.getReasonGist());

    List<MTurkHITContainerReasonClaimWarrantOriginal.ValidationWarrant> list = new ArrayList<>();

    list.add(new MTurkHITContainerReasonClaimWarrantOriginal.ValidationWarrant(0,
            reasonClaimWarrantContainer.getAlternativeWarrant()));
    list.add(new MTurkHITContainerReasonClaimWarrantOriginal.ValidationWarrant(1,
            reasonClaimWarrantContainer.getOriginalWarrant()));
    Collections.shuffle(list, random);

    list.add(new MTurkHITContainerReasonClaimWarrantOriginal.ValidationWarrant(2,
            "neither of them makes sense"));

    reasonClaimWarrant.validationWarrants.addAll(list);

    this.buffer.add(reasonClaimWarrant);
}
 
Example 13
Project: elasticsearch_my   File: CollectionUtilsTests.java   View Source Code Vote up 5 votes
public void testSortAndDedupByteRefArray() {
    SortedSet<BytesRef> set = new TreeSet<>();
    final int numValues = scaledRandomIntBetween(0, 10000);
    List<BytesRef> tmpList = new ArrayList<>();
    BytesRefArray array = new BytesRefArray(Counter.newCounter());
    for (int i = 0; i < numValues; i++) {
        String s = randomRealisticUnicodeOfCodepointLengthBetween(1, 100);
        set.add(new BytesRef(s));
        tmpList.add(new BytesRef(s));
        array.append(new BytesRef(s));
    }
    if (randomBoolean()) {
        Collections.shuffle(tmpList, random());
        for (BytesRef ref : tmpList) {
            array.append(ref);
        }
    }
    int[] indices = new int[array.size()];
    for (int i = 0; i < indices.length; i++) {
        indices[i] = i;
    }
    int numUnique = CollectionUtils.sortAndDedup(array, indices);
    assertThat(numUnique, equalTo(set.size()));
    Iterator<BytesRef> iterator = set.iterator();

    BytesRefBuilder spare = new BytesRefBuilder();
    for (int i = 0; i < numUnique; i++) {
        assertThat(iterator.hasNext(), is(true));
        assertThat(array.get(spare, indices[i]), equalTo(iterator.next()));
    }

}
 
Example 14
Project: unitimes   File: OnlineSectioningTestFwk.java   View Source Code Vote up 5 votes
public void test(int nrTasks, int... nrConcurrent) {
	try {
		configureLogging();
		
        HibernateUtil.configureHibernate(ApplicationProperties.getProperties());
        
		startServer();
		
		List<Operation> operations = operations();
		
		Collections.shuffle(operations);
		
		for (int c: nrConcurrent) {
			run(nrTasks <= 0 || operations.size() <= nrTasks ? operations : operations.subList(0, nrTasks), c);
		}
		
		logCounters();
		
		writeReports();
		
		stopServer();
	} catch (Exception e) {
		sLog.fatal("Test failed: " + e.getMessage(), e);
	} finally {
		close();
	}
}
 
Example 15
Project: Lucid2.0   File: RandomRewards.java   View Source Code Vote up 4 votes
private static void processRewardsSimple(final List<Integer> returnArray, final int[] list) {
    for (int i = 0; i < list.length; i++) {
        returnArray.add(list[i]);
    }
    Collections.shuffle(returnArray);
}
 
Example 16
Project: otter-G   File: ConfigRemoteServiceImpl.java   View Source Code Vote up 4 votes
public boolean notifyChannel(final Channel channel) {
    Assert.notNull(channel);
    // 获取所有的Node节点
    NotifyChannelEvent event = new NotifyChannelEvent();
    event.setChannel(channel);

    Set<String> addrsSet = new HashSet<String>();

    // 组装当前otter所有的存活的node节点
    // List<Node> nodes = nodeService.listAll();
    // for (Node node : nodes) {
    // if (node.getStatus().isStart() &&
    // StringUtils.isNotEmpty(node.getIp()) && node.getPort() != 0) {
    // final String addr = node.getIp() + ":" + node.getPort();
    // addrsList.add(addr);
    // }
    // }

    // 组装当前pipeline下的存活的node节点
    for (Pipeline pipeline : channel.getPipelines()) {
        List<Node> nodes = new ArrayList<Node>();
        nodes.addAll(pipeline.getSelectNodes());
        nodes.addAll(pipeline.getExtractNodes());
        nodes.addAll(pipeline.getLoadNodes());
        for (Node node : nodes) {
            if (node.getStatus().isStart() && StringUtils.isNotEmpty(node.getIp()) && node.getPort() != 0) {
                String addr = node.getIp() + ":" + node.getPort();
                if (node.getParameters().getUseExternalIp()) {
                    addr = node.getParameters().getExternalIp() + ":" + node.getPort();
                }
                addrsSet.add(addr);
            }
        }
    }

    List<String> addrsList = new ArrayList<String>(addrsSet);
    if (CollectionUtils.isEmpty(addrsList) && channel.getStatus().isStart()) {
        throw new ManagerException("no live node for notifyChannel");
    } else if (CollectionUtils.isEmpty(addrsList)) {
        // 针对关闭操作,可直接处理
        return true;
    } else {
        Collections.shuffle(addrsList);// 做一下随机,避免每次选择的机器都是同一台
        try {
            String[] addrs = addrsList.toArray(new String[addrsList.size()]);
            List<Boolean> result = (List<Boolean>) communicationClient.call(addrs, event); // 推送配置
            logger.info("## notifyChannel to [{}] channel[{}] result[{}]",
                new Object[] { ArrayUtils.toString(addrs), channel.toString(), result });

            boolean flag = true;
            for (Boolean f : result) {
                flag &= f;
            }

            return flag;
        } catch (Exception e) {
            logger.error("## notifyChannel error!", e);
            throw new ManagerException(e);
        }
    }
}
 
Example 17
Project: commercetools-sync-java   File: CategorySyncIT.java   View Source Code Vote up 4 votes
@Test
@SuppressFBWarnings("NP_NONNULL_PARAM_VIOLATION") // https://github.com/findbugsproject/findbugs/issues/79
public void syncDrafts_withExistingCategoriesThatChangeParents_ShouldUpdateCategories() {
    //-----------------Test Setup------------------------------------
    // Delete all categories in target project
    deleteAllCategories(CTP_TARGET_CLIENT);

    // Create a total of 3 categories in the target project (2 roots and 1 child to the first root)
    final List<Category> subFamily =
        createChildren(2, null, "root", CTP_TARGET_CLIENT);

    final Category firstRoot = subFamily.get(0);
    createChildren(1, firstRoot, "child", CTP_TARGET_CLIENT);

    //---------------------------------------------------------------

    // Create a total of 2 categories in the source project (2 roots and 1 child to the second root)
    final List<Category> sourceSubFamily =
        createChildren(2, null, "root", CTP_SOURCE_CLIENT);

    final Category secondRoot = sourceSubFamily.get(1);
    createChildren(1, secondRoot, "child", CTP_SOURCE_CLIENT);
    //---------------------------------------------------------------

    // Fetch categories from source project
    final List<Category> categories = CTP_SOURCE_CLIENT.execute(buildCategoryQuery())
                                                       .toCompletableFuture().join().getResults();

    // Put the keys in the reference ids to prepare for reference resolution
    final List<CategoryDraft> categoryDrafts = replaceCategoriesReferenceIdsWithKeys(categories);
    Collections.shuffle(categoryDrafts);

    final List<List<CategoryDraft>> batches = batchElements(categoryDrafts, 1);

    final CategorySyncStatistics syncStatistics = syncBatches(categorySync, batches,
        CompletableFuture.completedFuture(null)).toCompletableFuture().join();

    assertThat(syncStatistics).hasValues(3, 0, 1, 0, 0);
    assertThat(callBackErrorResponses).isEmpty();
    assertThat(callBackExceptions).isEmpty();
    assertThat(callBackWarningResponses).isEmpty();
}
 
Example 18
Project: hadoop-oss   File: LoadBalancingKMSClientProvider.java   View Source Code Vote up 4 votes
private static KMSClientProvider[] shuffle(KMSClientProvider[] providers) {
  List<KMSClientProvider> list = Arrays.asList(providers);
  Collections.shuffle(list);
  return list.toArray(providers);
}
 
Example 19
Project: spoj   File: Compare_1_and_2.java   View Source Code Vote up 4 votes
static void test(BiFunction<Integer, Edge[], int[]> f1, BiFunction<Integer, Edge[], int[]> f2) {
	Random rnd = new Random(1);

	for (int test = 0; test < 1000; test++) {

		int maxWeight = 3;

		int verticesCnt = rnd.nextInt(1500) + 2;
		int edgesCnt = rnd.nextInt(5000) + 1;

		// int verticesCnt = rnd.nextInt(150) + 2;
		// int edgesCnt = rnd.nextInt(555) + 1;

		// int verticesCnt = rnd.nextInt(5) + 2;
		// int edgesCnt = rnd.nextInt(10) + 1;

		Edge[] edges = new Edge[edgesCnt];
		for (int i = 0; i < edgesCnt; i++) {
			int from = rnd.nextInt(verticesCnt) + 1;
			int to = rnd.nextInt(verticesCnt) + 1;
			while (from == to) {
				to = rnd.nextInt(verticesCnt) + 1;
			}
			int baseWeight = rnd.nextInt(maxWeight) + 1;
			for (int j = 0; (j < (rnd.nextInt(4) + 1)) && (i < edgesCnt); j++, i++) {
				int w = rnd.nextInt(maxWeight) + 1;
				if (rnd.nextBoolean()) {
					w = baseWeight;
				}
				edges[i] = new Edge(from, to, w);
			}
			i--;
		}
		List<Edge> edgesList = Arrays.asList(edges);
		Collections.shuffle(edgesList);
		edges = edgesList.toArray(edges);

		long startTime = System.currentTimeMillis();
		compare(f1, f2, verticesCnt, edges);
		long endTime = System.currentTimeMillis();
		System.out.println("Time: " + (endTime - startTime) + " ms");
		System.out.println();
	}
}
 
Example 20
Project: Phoenicia   File: ImageMatchGameHUD.java   View Source Code Vote up 4 votes
private void show_round(int round) {
    int word_index = round % this.max_rounds;
    final Word challenge_word = this.random_word_list.get(word_index);

    // Take the challenge word out of the list and shuffle it
    List<Word> draw_words = new ArrayList<Word>(this.random_word_list);
    draw_words.remove(challenge_word);
    Collections.shuffle(draw_words);

    // Draw max_choices-1 from the list, add the challenge word to it and shuffle again
    List<Word> choice_words = draw_words.subList(0, this.max_choices-1);
    choice_words.add(challenge_word);
    Collections.shuffle(choice_words);

    for (int i = 0; i < choice_words.size(); i++) {
        final Word word = choice_words.get(i);
        float available_width = (this.cardPane.getWidth()/choice_words.size());
        final float wordX = i*(this.cardPane.getWidth()/choice_words.size());
        final float wordY = this.cardPane.getHeight() - 150;
        ITextureRegion sprite_region = this.game.wordSprites.get(word);
        ButtonSprite wordSprite = new ButtonSprite(wordX+(available_width/2), wordY, sprite_region, PhoeniciaContext.vboManager, new ButtonSprite.OnClickListener() {
            @Override
            public void onClick(ButtonSprite buttonSprite, float v, float v1) {
                if (word == challenge_word) {
                    pass(word, wordX);
                } else {
                    fail(word, wordX);
                }
                next_round();
            }
        });
        wordSprite.setScale(2.0f);

        this.registerTouchArea(wordSprite);
        this.touchAreas.add(wordSprite);
        this.cardPane.attachChild(wordSprite);
    }

    Font wordFont = GameFonts.introText();
    Text challenge_text = new Text(this.cardPane.getWidth()/2, this.cardPane.getHeight() - 300, wordFont, String.valueOf(challenge_word.chars), challenge_word.chars.length, new TextOptions(HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
    challenge_text.setX(this.cardPane.getWidth() / 2);
    this.cardPane.attachChild(challenge_text);
}