rpjday wrote:
>
> On Mon, 19 Feb 2001, Bret Hughes wrote:
>
> > rpjday wrote:
> > >
> > > actually, if you examine the algorithm, the probability that line n
> > > will be chosen as the "new" random line as you read through the file
> > > is precisely 1/n, so all lines are equally likely.
> >
>
On Mon, 19 Feb 2001, Bret Hughes wrote:
> rpjday wrote:
> >
> > actually, if you examine the algorithm, the probability that line n
> > will be chosen as the "new" random line as you read through the file
> > is precisely 1/n, so all lines are equally likely.
>
> I don't think that is what is hap
rpjday wrote:
>
> actually, if you examine the algorithm, the probability that line n
> will be chosen as the "new" random line as you read through the file
> is precisely 1/n, so all lines are equally likely.
I don't think that is what is happening here. I don't think that all
lines are equall
On Mon, 19 Feb 2001, Bret Hughes wrote:
> Johannes Eriksson wrote:
> >
> > * Bret Hughes [Mon, Feb 19, 2001 at 12:39:22AM -0600]:
> > > i believe you. I just can't figure out what it is doing? I have been
> > > working with perl lately and always looking to learn. Can you explain
> > > what it
Johannes Eriksson wrote:
>
> * Bret Hughes [Mon, Feb 19, 2001 at 12:39:22AM -0600]:
> > i believe you. I just can't figure out what it is doing? I have been
> > working with perl lately and always looking to learn. Can you explain
> > what it is doing please?
> Here's the same script in a les
* Bret Hughes [Mon, Feb 19, 2001 at 12:39:22AM -0600]:
> i believe you. I just can't figure out what it is doing? I have been
> working with perl lately and always looking to learn. Can you explain
> what it is doing please?
>
> this also appears to work:
> perl -e 'rand($.)<1&&($l=$_)while<>;
On Mon, 19 Feb 2001, Bret Hughes wrote:
> Johannes Eriksson wrote:
> >
>
>
> > perl -e 'rand;rand($.)<1&&($l=$_)while<>;print $l;' < file
> >
> > It works. Believe me.
>
> i believe you. I just can't figure out what it is doing? I have been
> working with perl lately and always looking to lea
Johannes Eriksson wrote:
>
> perl -e 'rand;rand($.)<1&&($l=$_)while<>;print $l;' < file
>
> It works. Believe me.
i believe you. I just can't figure out what it is doing? I have been
working with perl lately and always looking to learn. Can you explain
what it is doing please?
this also
Johannes Eriksson wrote:
> #!/usr/bin/perl
>
> srand;
> for (;;)
> {
> @f = <*.mp3>;
> @s=();
> (push(@s,splice(@f,rand @f,1))) while (@f);
> map {system ("amp","-p",$_)} @s;
> }
>
> It will loop ad inifinitum, playing all mp3 files in the working
> directory randomly sh
* Bret Hughes [Sun, Feb 18, 2001 at 09:01:39PM -0600]:
>
> *** random_line.sh ***
> #!/bin/bash
>
> ##
> ## Name:
> ##random_line.sh
> ##
> ## Version:
> ##$Revision: 1.2 $
> ##
> ## Purpose:
> ##Print a random line from a specified file.
> #
On Sun, 18 Feb 2001, Ashley M. Kirchner wrote:
>
> a) If I do 'ls -AQU *.mp3', the result is always sorted.
>However, if I just do 'ls -AQU' it's not sorted.
>
This little script should give you a randomized selection of
the MP3's.
-- cut --
#!/bin/bash
let m=32768 n=0
while:
do
Dave Wreski wrote:
>
> > However, this will play the files sequentially, in (sorted) order. I
> > want it to be randomized, like the output of 'ls -AQU'
>
> while [ 1 ]
> do
> for mp3 in `/bin/ls -AQU *.mp3`
> do
> amp -p $mp3
> done
> done
>
see if
On Sun, 18 Feb 2001, Ashley M. Kirchner wrote:
>
> a) If I do 'ls -AQU *.mp3', the result is always sorted.
>However, if I just do 'ls -AQU' it's not sorted.
>
The shell (bash?) is sorting them for you.
Type:
echo ls -AQU *.mp3
to see what the command looks like after th
* Ashley M. Kirchner [Sun, Feb 18, 2001 at 04:52:21PM -0700]:
> Dave Wreski wrote:
>
> > while [ 1 ]
> > do
> > for mp3 in `/bin/ls -AQU *.mp3`
> > do
> > amp -p $mp3
> > done
> > done
>
> Hrm, something's not right.
>
> a) If I do 'ls -AQU *.mp3'
* Vidiot [Sun, Feb 18, 2001 at 04:53:42PM -0600]:
> >What's the best/safest way to loop a script over and over again?
> >
> >All it does is call a different program with arguments (it plays mp3
> >files) and I want it to loop and start again when it reaches the end.
> >
> >#!/bin/sh
>
Dave Wreski wrote:
> while [ 1 ]
> do
> for mp3 in `/bin/ls -AQU *.mp3`
> do
> amp -p $mp3
> done
> done
Hrm, something's not right.
a) If I do 'ls -AQU *.mp3', the result is always sorted.
However, if I just do 'ls -AQU' it's not sorted.
Vidiot wrote:
> >while [ 1 ]
> >do
> > for mp3 in `/bin/ls -AQU *.mp3`
> > do
> > amp -p $mp3
> > done
> >done
>
> But that isn't truly random either, because once a pass is completed, it
> will repeat the same pass.
That, is okay actually. There are enough s
>> However, this will play the files sequentially, in (sorted) order. I
>> want it to be randomized, like the output of 'ls -AQU'
>
>while [ 1 ]
>do
> for mp3 in `/bin/ls -AQU *.mp3`
> do
> amp -p $mp3
> done
>done
But that isn't truly random either, because o
>Mike McNally wrote:
>
>> You can also make it play all .mp3 files in a directory
>> like this:
>>
>> #!/bin/sh
>>
>> while :; do
>>for mp3 in *.mp3; do
>> amp -p "$mp3"
>>done
>> done
>
>However, this will play the files sequentially, in (sorted) order. I
>want it to be randomi
> However, this will play the files sequentially, in (sorted) order. I
> want it to be randomized, like the output of 'ls -AQU'
while [ 1 ]
do
for mp3 in `/bin/ls -AQU *.mp3`
do
amp -p $mp3
done
done
___
Mike McNally wrote:
> You can also make it play all .mp3 files in a directory
> like this:
>
> #!/bin/sh
>
> while :; do
>for mp3 in *.mp3; do
> amp -p "$mp3"
>done
> done
However, this will play the files sequentially, in (sorted) order. I
want it to be randomized, like the o
On Sun, 18 Feb 2001, Vidiot wrote:
> >What's the best/safest way to loop a script over and over again?
> >
> >All it does is call a different program with arguments (it plays mp3
> >files) and I want it to loop and start again when it reaches the end.
> >
> >#!/bin/sh
> >amp -p "f
>What's the best/safest way to loop a script over and over again?
>
>All it does is call a different program with arguments (it plays mp3
>files) and I want it to loop and start again when it reaches the end.
>
>#!/bin/sh
>amp -p "file one.mp3"
>amp -p "file two.mp3"
>...
23 matches
Mail list logo