📄 createrandomtree.java
字号:
// CreateRandomTree.java// Copyright (c) 1998, Regents of the University of California// $Id: CreateRandomTree.java,v 1.1 1999/06/21 00:34:21 marcel Exp $import java.util.Random;public class CreateRandomTree { public static Random random = new Random(); public static Node makeTree(int levels) { Node root = new Node((int)(random.nextDouble()*256)); if (levels == 0) return root; int nchild = (int)(random.nextDouble()*4) + 1; Node[] children = new Node[nchild]; for(int i=0; i < nchild; i++) children[i] = makeTree(levels - 1); root.children = children; return root; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -