PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 10th, 2004, 01:02 PM
nuLime nuLime is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 nuLime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 15 sec
Reputation Power: 0
Question Creating a 'predictable' random array sort

I am trying to figure out a way to create an array sorting algorithm that if handed an array of the same elements, will shuffle them in into exact the same 'random' order.

For instance, I have an array filled with the values: flour, eggs, milk, sugar, water

I need to pull the values in exactly that order in one part of the code, but I need them to be randomized for the next part. This script is called numerous times and each time the values that are randomized must always be in the same order as the previous time the script was called.

For instance, using the above example of "flour, eggs, milk, sugar, water", the randomized output might be "water, milk, eggs, flour, sugar". The next time the script is run, the randomization needs to be "water, milk, eggs, flour, sugar" if handed the exact same array of "flour, eggs, milk, sugar, water" just as before.

How could I go about doing this without making the array shuffle truly random?

I do not want to use natcasesort(), rsort(), or whatever as those are always too predictable.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Creating a 'predictable' random array sort


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway