+ Tree generates a random number

rand () is 0 to 32767 

To prevent the emergence of 0

(Rand ()% .. + 1) * (rand ()% ... + 1) 

srand(time(NULL))

 

Spanning Tree

for(int i=2;....)
{
  j=rand()%(i-1)+1;

  len = rand ()% 10000;
}

Generate binary tree 

j=i-rand()%2+1;

 

 

Examples

Multi-tree and chain

 

Guess you like

Origin www.cnblogs.com/OIEREDSION/p/11418611.html