[ 
http://dev.sourcefabric.org/browse/LS-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16746#action_16746
 ] 

David Baelde commented on LS-542:
---------------------------------

Please provide evidence. I ran some quick tests here and I don't believe the 
shuffling function does what you say, unless Random.self_init is really bad. 
Note that shuffling isn't the only aspect: after that, a valid request has to 
be found, which may take several attempts.


# let randomize a =
    let permute i j =
      let tmp = a.(i) in
        a.(i) <- a.(j);
        a.(j) <- tmp
    in
    let l = Array.length a in
      if l>=2 then
        for i=0 to l-2 do
          permute i (i + Random.int (l-i))
        done
  ;;

# Random.self_init () ; let a = Array.init 100 (fun i -> i) in randomize a ; a 
;;
- : int array =
[|9; 84; 50; 96; 23; 27; 43; 36; 70; 4; 5; 6; 74; 69; 95; 60; 37; 80; 98; 0;
  54; 83; 53; 39; 89; 81; 15; 79; 32; 55; 66; 40; 91; 99; 62; 30; 67; 48; 75;
  85; 46; 76; 33; 35; 11; 61; 26; 71; 44; 34; 2; 57; 92; 29; 93; 94; 86; 56;
  49; 78; 17; 88; 1; 41; 87; 82; 68; 58; 13; 59; 73; 42; 3; 25; 7; 8; 65; 19;
  21; 12; 38; 20; 64; 47; 10; 72; 77; 45; 24; 31; 51; 18; 90; 22; 52; 28; 97;
  14; 63; 16|]

Repeat it as many times as you want...

> randomize for playlists is not so random
> ----------------------------------------
>
>                 Key: LS-542
>                 URL: http://dev.sourcefabric.org/browse/LS-542
>             Project: Liquidsoap
>          Issue Type: Bug
>            Reporter: Samuel Mimram
>            Priority: Major
>
> I use "playlist(directory)" for testing, and by default the mode is 
> randomize. The starting song is "random", but I got many times the same song 
> as first song, too many times for me to believe in randomness (the directory 
> is my mp3 library which is fairly large...).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://dev.sourcefabric.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Savonet-devl mailing list
Savonet-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-devl

Répondre à