Backend for songs.zachdecook.com
* Song Suggestions: Seed random numbers by current minute
(for better group song selection)
Zach DeCook 2018-03-11
parent 0026ca4 · commit 0402389
-rw-r--r--page.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/page.php b/page.php
index cdc7921..ef8f6d8 100644
--- a/page.php
+++ b/page.php
@@ -69,6 +69,8 @@ function refToNum( $ref )
*/
function load_song( $number, $transp = 0 )
{
+ // Song suggestions are based on the minute you loaded the page
+ mt_srand( time()/60 );
$handle = fopen("inputfile.txt", "r");
if( ! $transp ) $transp = 0;
@@ -93,7 +95,7 @@ function load_song( $number, $transp = 0 )
{
$allsongs[$matches[1]] = $line;
$current_song = $matches[1];
- if( rand(0,100) < 5 )
+ if( mt_rand(0,100) < 5 )
{
$suggestedSong[$current_song]['title'] = $line;
}