【问题】
I have a text file rext.txt and I'm trying to get first 100 random words from each line of the text file and put them into String array, but it's not working. I figured how to separate files from text and put them into array, but I can't figure where to include 100 to get them sorted. Thank you!!!
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Random;
import java.util.Scanner;
public class New2
{
public static void main(String[] args) throws FileNotFoundException
{
Scanner sc = new Scanner(new File("dictionary.txt"));
while (sc.hasNext())
{
String word = sc.next();
sc.nextLine();
String[] wordArray = word.split(" ");
//System.out.println(Arrays.toString(wordArray));
int idx = new Random().nextInt(wordArray.length);
String random = (