Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8511

Re: Random function

Message-ID <1596284.F5I4JHaoKD@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-02-28 00:22 +0100
Subject Re: Random function
Newsgroups comp.lang.php
References <3bbc3c88-ba02-4c72-843a-b87b01bc7c6b@googlegroups.com> <kggpci$1sgb$2@yojimbo.hack> <kgkptu$b9r$1@dont-email.me>

Show all headers | View raw


Markus Grob wrote:

> Salvatore schrieb:
>> On 2013-02-25, sonnichjensen@gmail.com <sonnichjensen@gmail.com> wrote:
>>> I use the rand function to get 10 items of 1808 current itemes.
>>
>> If you want ten random items from an array, you could try the following:
>>
>> <?php
>> // This is the big array you're pulling something out of.
>> $lotsOfItems = array( /* ... */ );
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ...
> 
> Sorry, but this line is the problem, which every pseudo random generator
> has. What will you fill in here. What is really different.

That is *irrelevant*.  The items *there* do not need to be different and can 
even be ordered.  It is just the data base for subsequent (pseudo-)random 
selection; it suffices that the *key* for accessing that array is a 
(pseudo-)random number, and if key repetitions are to be avoided, that you 
remember which keys have been used.

> Do you have anything, that's changing in an order, you couldn't tell?
> […]

Sorry, you are posting in gibberish even for a native speaker of German who 
could, in theory, try to guess what you meant in English by translating that 
word-by-word back to German.  But in practice, with what you posted this one 
cannot.  Therefore, I strongly suggest you stop posting in English until you 
improve your English so as you need not rely only on online translators.


PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Random function sonnichjensen@gmail.com - 2013-02-25 12:48 -0800
  Re: Random function Salvatore <sal@yojimbo.hack.invalid> - 2013-02-25 20:57 +0000
    Re: Random function Luuk <luuk@invalid.lan> - 2013-02-25 22:13 +0100
      Re: Random function Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-25 16:42 -0500
      Re: Random function The Natural Philosopher <tnp@invalid.invalid> - 2013-02-25 22:12 +0000
      Re: Random function Robert Heller <heller@deepsoft.com> - 2013-02-25 19:46 -0600
  Re: Random function Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-25 16:39 -0500
  Re: Random function The Natural Philosopher <tnp@invalid.invalid> - 2013-02-25 22:11 +0000
  Re: Random function Salvatore <sal@yojimbo.hack.invalid> - 2013-02-25 22:42 +0000
    Re: Random function "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-26 11:18 +0100
      Re: Random function Paul Herber <paul@pherber.com> - 2013-02-26 13:52 +0000
    Re: Random function Markus Grob <snoopy@ilnet.ch> - 2013-02-27 12:17 +0100
      Re: Random function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-28 00:22 +0100

csiph-web