Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-27 16:18:41

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Math: Doubles in randomly sorted article list?

I wonder:
If i set an article list (so more than one article) to sort=“rand()”: Do i really get each possible article only once?
In other words, in a list of ten articles from a pool of 10, is there a high risk of doubles?
If not i presume, that an array has been randomly filled with possible article IDs, before the list is rendered, and each item rendered is no longer present in that array?
If that array exists, can i access it and how?

Thanx for any insights!

Last edited by jayrope (2011-07-27 16:19:16)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2011-07-27 18:12:56

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: Math: Doubles in randomly sorted article list?

rand() is a SQL function. There’s no risk, I guess :)

Offline

#3 2011-07-27 19:10:16

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Math: Doubles in randomly sorted article list?

Yes, you’ll get each possible article only once. I think there is no guarantee though, that in n list refreshes, the same article won’t be on top every time, for example.

Last edited by maruchan (2011-07-27 19:10:39)

Offline

#4 2011-07-28 06:59:17

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,376
Website GitHub Mastodon

Re: Math: Doubles in randomly sorted article list?

maruchan wrote:

I think there is no guarantee though..

…which is the core concept of “randomness” ;)

Offline

Board footer

Powered by FluxBB