Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ipalp_shrnuti;
- import java.util.Random;
- import java.util.Scanner;
- public class MyLib {
- public void vypis(String s) {
- System.out.println(s);
- }
- public void vypisCervene(String s) {
- System.out.println("\u001B[31m" + s);
- }
- public void vypisModre(String s) {
- System.out.println("\u001B[34m" + s);
- }
- public void vypisZelene(String s) {
- System.out.println("\u001B[32m" + s);
- }
- public String nactiText() {
- Scanner in = new Scanner(System.in);
- String slovo = in.nextLine();
- return slovo;
- }
- public float nactiCislo() {
- float f;
- Scanner in = new Scanner(System.in);
- f = in.nextFloat();
- return f;
- }
- public int nactiCeleCislo() {
- int f;
- Scanner in = new Scanner(System.in);
- f = in.nextInt();
- return f;
- }
- public int generujNahodneCislo(int min, int max) {
- int f;
- Random rand = new Random();
- f = rand.nextInt((max - min) + 1) + min;
- return f;
- }
- public int[] generujPole(int velikost, int min, int max) {
- Random rand = new Random();
- int[] pole = new int[velikost];
- for (int i = 0; i < pole.length; i++) {
- pole[i] = rand.nextInt((max - min) + 1) + min;
- }
- return pole;
- }
- public void vypisPole(int [] pole) {
- for (int i = 0; i < pole.length; i++) {
- System.out.format("%3d", pole[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement