Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> tablica randomów bez powtórzeń
bluebird
post
Post #1





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 9.09.2009

Ostrzeżenie: (0%)
-----


Witam, jak stworzyć wektor losowych liczb od x do y bez powtórzeń?
Go to the top of the page
+Quote Post
Wicepsik
post
Post #2





Grupa: Zarejestrowani
Postów: 1 575
Pomógł: 299
Dołączył: 26.03.2009

Ostrzeżenie: (20%)
X----


http://www.php.net/manual/en/function.rand.php#91531


--------------------
Go to the top of the page
+Quote Post
wookieb
post
Post #3





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




+ array_unique


--------------------
Go to the top of the page
+Quote Post
pyro
post
Post #4





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


Cytat(wookieb @ 13.05.2010, 16:15:37 ) *
+ array_unique


albo i bez

  1. $x = 1;
  2. $y = 100;
  3. $numbers = array_rand(range($x, $y), 5);


--------------------
ET LINGUA EIUS LOQUETUR IUDICIUM
Go to the top of the page
+Quote Post
bluebird
post
Post #5





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 9.09.2009

Ostrzeżenie: (0%)
-----


dzieki smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 04:37