Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Punto3 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Random random = new Random();
- int root;
- double inicio = System.currentTimeMillis();
- double fin;
- double tiempo;
- for (int i = 1; i <= 20; i++) {
- root = random.nextInt(1,20);
- System.out.println(SumRootN(root));
- }
- fin = System.currentTimeMillis();
- tiempo = fin-inicio;
- System.out.println("Tiempo transcurrido sin concurrencia: "+tiempo);
- for (int i = 1; i <= 20; i++) {
- Hilo hilo = new Hilo(i);
- hilo.start();
- }
- }
- public static double SumRootN(int root) {
- double result = 0;
- for (int i = 0; i < 10000000; i++) {
- result += Math.exp(Math.log(i) / root);
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement