/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import java.util.Random;
/**
*
* @author Patryk
*/
public class tab {
private int liczba = 49;
private int tab[];
private int tabPom[];
private boolean jest = false;
private int k = 0;
public tab(int n)
{
this.tab = new int[n];
this.tabPom = new int[n];
}
public void losuj()
{
Random rand = new Random();
for(int i=0; i<tab.length; i++)
{
tab[i] = rand.nextInt(49) + 1;
jest = false;
for(int j=0; j<i; j++)
{
if(tab[i] == tab[j]){
jest = true;
liczba--;
}
}
if(jest == false)
{
tabPom[k] = tab[i];
k++;
}
}
}
public void wypisz()
{
for(int i=0; i<k; i++)
{
System.out.print(tabPom[i] + " " );
}
}
}
witam program zawsze losuje liczby bez powtórzeń niestety nie zawsze tyle ile chcę pomoże ktoś, nie chcę gotowego rozwiązania jednak naprowadzenia wskazówki ponieważ chcę się nauczyć