Random BGSOUND script

Random BGSOUND script

am 15.01.2008 12:34:33 von Fred Atkinson

I've written a PHP script that randomly selects a sound file
to play for the BGSOUND tag. It appears below. All you have to do is
place it between the and tags on a PHP Web page.

$array = array("sound_1.wav",
"sound_2.wav",
"sound_3.wav");
$n = rand (0, 2);
$sound_file = $array[$n];
echo "\n"
?>

The problem is that when I test it, it seems to favor the
first and the last sound file and rarely plays the second one.

Is there a better way to make the random number selection more
evenly distributed?

Before you start jumping on me about music in the background,
that's not what I am doing. Go to http://www.wb4aej.com for a working
example. I've got a test page (with a refresh button) on
http://www.wb4aej.com/random_wav.php . If you don't copy Morse code,
you probably won't understand the different sounds except that the
first few characters of each sound file are a little different. Each
file plays for only a few seconds and stops.

I've also added links to the test page so you can play the
random files individually.

Regards,




Fred

Re: Random BGSOUND script

am 15.01.2008 14:17:37 von Floortje

Fred Atkinson wrote:
> I've written a PHP script that randomly selects a sound file
> to play for the BGSOUND tag.
....

> The problem is that when I test it, it seems to favor the
> first and the last sound file and rarely plays the second one.

Are you sure ??

> Is there a better way to make the random number selection more
> evenly distributed?

$array = array("sound_1.wav","sound_2.wav","sound_3.wav");

echo '';



Arjen

Re: Random BGSOUND script

am 15.01.2008 14:41:17 von Floortje

floortje wrote:
> Fred Atkinson wrote:
>> I've written a PHP script that randomly selects a sound file
>> to play for the BGSOUND tag.

> echo '';

should be
echo ' src="'.$array[floor(rand(0,(count($array)*100)-1)/100)].'">' ;

>
> Arjen

Re: Random BGSOUND script

am 15.01.2008 17:53:55 von Steve

"Fred Atkinson" wrote in message
news:up5po3t6dgt09e7lqknlu0gre57emlvrfb@4ax.com...
> I've written a PHP script that randomly selects a sound file
> to play for the BGSOUND tag. It appears below. All you have to do is
> place it between the and tags on a PHP Web page.
>
> > $array = array("sound_1.wav",
> "sound_2.wav",
> "sound_3.wav");
> $n = rand (0, 2);
> $sound_file = $array[$n];
> echo "\n"
> ?>
>
> The problem is that when I test it, it seems to favor the
> first and the last sound file and rarely plays the second one.
>
> Is there a better way to make the random number selection more
> evenly distributed?
>
> Before you start jumping on me about music in the background,
> that's not what I am doing. Go to http://www.wb4aej.com for a working
> example. I've got a test page (with a refresh button) on
> http://www.wb4aej.com/random_wav.php . If you don't copy Morse code,
> you probably won't understand the different sounds except that the
> first few characters of each sound file are a little different. Each
> file plays for only a few seconds and stops.
>
> I've also added links to the test page so you can play the
> random files individually.

you should be using mt_rand instead. you can also increase the pool...then,
get the result to apply, i.e. use %

$key = mt_rand(0, 10000) % count($array);
echo 'bgsound src="' . $key . '" />';

Re: Random BGSOUND script

am 15.01.2008 18:09:49 von Steve

>> Before you start jumping on me about music in the background,
>> that's not what I am doing. Go to http://www.wb4aej.com for a working
>> example. I've got a test page (with a refresh button) on
>> http://www.wb4aej.com/random_wav.php . If you don't copy Morse code,
>> you probably won't understand the different sounds except that the
>> first few characters of each sound file are a little different. Each
>> file plays for only a few seconds and stops.

yeah, still annoying as fuck, fred. btw, professor, logic follows that "if
you don't copy Morse code", save divine intervention or hours of reverse
engineering, you *won't* understand what the message is (you must be a prof.
of art or something [not bound to the use of logic, but the foregoing
thereof]). enter google to get a morse code table. i merrily get to bypass
that since i learned it when i was about 10...love those walkie, talkies.

putting music/sound on a web page is fine...NEVER initiate its playback
YOURSELF !!!

you do realize that giving the link above, that i have an address and photo
of you and know who your employer is? you and jerry are nuts!!! btw, isn't
jerry-berry from georgia too? it's got to be in the water, i tell you!

as for mishmash...you're wasting domain name registration dollars. but, i
suppose it's your cash to waste.

Registrant:
Fred Atkinson
P. O. Box 965458
Marietta, Georgia 30066-0008
United States

Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
Domain Name: WB4AEJ.COM
Created on: 24-Sep-00
Expires on: 24-Sep-09
Last Updated on:

Administrative Contact:
Atkinson, Fred fatkinson@mishmash.com
P. O. Box 965458
Marietta, Georgia 30066-0008
United States
404-418-5176 Fax -- 415-486-1599

Technical Contact:
Atkinson, Fred fred@wb4aej.com
P. O. Box 965458
Marietta, Georgia 30066-0008
United States
404-418-5176 Fax -- 415-486-1599

Domain servers in listed order:
NS12.ZONEEDIT.COM
NS18.ZONEEDIT.COM

Re: Random BGSOUND script

am 15.01.2008 18:28:41 von Steve

"Steve" wrote in message
news:rN5jj.30$GW7.9@newsfe05.lga...
> you do realize that giving the link above, that i have an address and
> photo of you and know who your employer is? you and jerry are nuts!!! btw,
> isn't jerry-berry from georgia too? it's got to be in the water, i tell
> you!
>
> as for mishmash...you're wasting domain name registration dollars. but, i
> suppose it's your cash to waste.
>
> Registrant:
> Fred Atkinson
> P. O. Box 965458
> Marietta, Georgia 30066-0008
> United States
>
> Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
> Domain Name: WB4AEJ.COM
> Created on: 24-Sep-00
> Expires on: 24-Sep-09
> Last Updated on:
>
> Administrative Contact:
> Atkinson, Fred fatkinson@mishmash.com
> P. O. Box 965458
> Marietta, Georgia 30066-0008
> United States
> 404-418-5176 Fax -- 415-486-1599
>
> Technical Contact:
> Atkinson, Fred fred@wb4aej.com
> P. O. Box 965458
> Marietta, Georgia 30066-0008
> United States
> 404-418-5176 Fax -- 415-486-1599
>
> Domain servers in listed order:
> NS12.ZONEEDIT.COM
> NS18.ZONEEDIT.COM

and oh hell, did i just post your real, live email addresses for the next
spambot to parse? mmmm...and phone/fax numbers too.

:)

Re: Random BGSOUND script

am 15.01.2008 21:40:16 von Fred Atkinson

On Tue, 15 Jan 2008 11:28:41 -0600, "Steve"
wrote:

>
>"Steve" wrote in message
>news:rN5jj.30$GW7.9@newsfe05.lga...
>> you do realize that giving the link above, that i have an address and
>> photo of you and know who your employer is? you and jerry are nuts!!! btw,
>> isn't jerry-berry from georgia too? it's got to be in the water, i tell
>> you!
>>
>> as for mishmash...you're wasting domain name registration dollars. but, i
>> suppose it's your cash to waste.
>>
>> Registrant:
>> Fred Atkinson
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>>
>> Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
>> Domain Name: WB4AEJ.COM
>> Created on: 24-Sep-00
>> Expires on: 24-Sep-09
>> Last Updated on:
>>
>> Administrative Contact:
>> Atkinson, Fred fatkinson@mishmash.com
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>> 404-418-5176 Fax -- 415-486-1599
>>
>> Technical Contact:
>> Atkinson, Fred fred@wb4aej.com
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>> 404-418-5176 Fax -- 415-486-1599
>>
>> Domain servers in listed order:
>> NS12.ZONEEDIT.COM
>> NS18.ZONEEDIT.COM
>
>and oh hell, did i just post your real, live email addresses for the next
>spambot to parse? mmmm...and phone/fax numbers too.
>
>:)
>
I won't waste my time arguing with an idiot.




Fred

Re: Random BGSOUND script

am 15.01.2008 22:22:17 von Daniel Ennis

Steve wrote:
> "Steve" wrote in message
> news:rN5jj.30$GW7.9@newsfe05.lga...
>> you do realize that giving the link above, that i have an address and
>> photo of you and know who your employer is? you and jerry are nuts!!! btw,
>> isn't jerry-berry from georgia too? it's got to be in the water, i tell
>> you!
>>
>> as for mishmash...you're wasting domain name registration dollars. but, i
>> suppose it's your cash to waste.
>>
>> Registrant:
>> Fred Atkinson
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>>
>> Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
>> Domain Name: WB4AEJ.COM
>> Created on: 24-Sep-00
>> Expires on: 24-Sep-09
>> Last Updated on:
>>
>> Administrative Contact:
>> Atkinson, Fred fatkinson@mishmash.com
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>> 404-418-5176 Fax -- 415-486-1599
>>
>> Technical Contact:
>> Atkinson, Fred fred@wb4aej.com
>> P. O. Box 965458
>> Marietta, Georgia 30066-0008
>> United States
>> 404-418-5176 Fax -- 415-486-1599
>>
>> Domain servers in listed order:
>> NS12.ZONEEDIT.COM
>> NS18.ZONEEDIT.COM
>
> and oh hell, did i just post your real, live email addresses for the next
> spambot to parse? mmmm...and phone/fax numbers too.
>
> :)
>
>

Um, are you 12? Welcome to the internet. Whois records isn't nothing
special...

You know, some of us want exposure. Hi I'm Daniel!

And your trying to attack this guy for no reason, just because he wants
to auto play a php file?... You need to grow up, or leave the internet.

Someone with an attitude like yours will find yourself crying one day
and regretting ever connecting to the internet.

Kids: Flash games are not on newsgroups. Go back to your games.
--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel@fanetworks.net

Re: Random BGSOUND script

am 15.01.2008 23:45:06 von Steve

"Fred Atkinson" wrote in message
news:bg6qo35ctttc52uq99en3o6bn646tcvq3l@4ax.com...
> On Tue, 15 Jan 2008 11:28:41 -0600, "Steve"
> wrote:
>
>>
>>"Steve" wrote in message
>>news:rN5jj.30$GW7.9@newsfe05.lga...
>>> you do realize that giving the link above, that i have an address and
>>> photo of you and know who your employer is? you and jerry are nuts!!!
>>> btw,
>>> isn't jerry-berry from georgia too? it's got to be in the water, i tell
>>> you!
>>>
>>> as for mishmash...you're wasting domain name registration dollars. but,
>>> i
>>> suppose it's your cash to waste.
>>>
>>> Registrant:
>>> Fred Atkinson
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>>
>>> Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
>>> Domain Name: WB4AEJ.COM
>>> Created on: 24-Sep-00
>>> Expires on: 24-Sep-09
>>> Last Updated on:
>>>
>>> Administrative Contact:
>>> Atkinson, Fred fatkinson@mishmash.com
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>> 404-418-5176 Fax -- 415-486-1599
>>>
>>> Technical Contact:
>>> Atkinson, Fred fred@wb4aej.com
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>> 404-418-5176 Fax -- 415-486-1599
>>>
>>> Domain servers in listed order:
>>> NS12.ZONEEDIT.COM
>>> NS18.ZONEEDIT.COM
>>
>>and oh hell, did i just post your real, live email addresses for the next
>>spambot to parse? mmmm...and phone/fax numbers too.
>>
>>:)
>>
> I won't waste my time arguing with an idiot.

but the it/mis professor will take my code snippet because he can't figure
out something so simple. :)

Re: Random BGSOUND script

am 16.01.2008 00:12:34 von Steve

"Daniel Ennis" wrote in message
news:478d24b2$0$4615$c3e8da3@news.astraweb.com...
> Steve wrote:
>> "Steve" wrote in message
>> news:rN5jj.30$GW7.9@newsfe05.lga...
>>> you do realize that giving the link above, that i have an address and
>>> photo of you and know who your employer is? you and jerry are nuts!!!
>>> btw, isn't jerry-berry from georgia too? it's got to be in the water, i
>>> tell you!
>>>
>>> as for mishmash...you're wasting domain name registration dollars. but,
>>> i suppose it's your cash to waste.
>>>
>>> Registrant:
>>> Fred Atkinson
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>>
>>> Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
>>> Domain Name: WB4AEJ.COM
>>> Created on: 24-Sep-00
>>> Expires on: 24-Sep-09
>>> Last Updated on:
>>>
>>> Administrative Contact:
>>> Atkinson, Fred fatkinson@mishmash.com
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>> 404-418-5176 Fax -- 415-486-1599
>>>
>>> Technical Contact:
>>> Atkinson, Fred fred@wb4aej.com
>>> P. O. Box 965458
>>> Marietta, Georgia 30066-0008
>>> United States
>>> 404-418-5176 Fax -- 415-486-1599
>>>
>>> Domain servers in listed order:
>>> NS12.ZONEEDIT.COM
>>> NS18.ZONEEDIT.COM
>>
>> and oh hell, did i just post your real, live email addresses for the next
>> spambot to parse? mmmm...and phone/fax numbers too.
>>
>> :)
>
> Um, are you 12? Welcome to the internet. Whois records isn't nothing
> special...

no, but putting traceable information out on the internet in usenet is just
asking for trouble. in a way, i'm warning him not to be stupid...despite his
ignorance to all other such warnings to date.

> And your trying to attack this guy for no reason, just because he wants to
> auto play a php file?... You need to grow up, or leave the internet.

no, it revolves around another thread. and, as the good professor still
can't RTFM or think creatively, i'll continue to harrass him.

> Someone with an attitude like yours will find yourself crying one day and
> regretting ever connecting to the internet.

really? why would that be? i didn't know attitude was prerequisite to
internet usage. rof.

> Kids: Flash games are not on newsgroups. Go back to your games.

hmmmm...not sure where you're getting that. not even sure what you mean by
it.

Re: Random BGSOUND script

am 16.01.2008 00:26:04 von Steve

"Steve" wrote in message
news:Fy5jj.24$GW7.23@newsfe05.lga...
> $key = mt_rand(0, 10000) % count($array);
> echo 'bgsound src="' . $key . '" />';

just to be clear...

$morse = array(
'sound_1.wav' ,
'sound_2.wav' ,
'sound_3.wav'
);
$key = mt_rand(0, 10000) % count($morse);
echo '';


still an instant "i'm leaving this site now" hit with end-users because of
bgsound. however, i don't think garnering returning visitors is your aim
based on this site or the mismash site. design theory was never a
prerequisite to your being an it/mis professor? i guess that's why you hear
about john hopkins medical program...and nothing else. :)

Re: Random BGSOUND script

am 16.01.2008 01:22:32 von Daniel Ennis

Steve wrote:

>> Um, are you 12? Welcome to the internet. Whois records isn't nothing
>> special...
>
> no, but putting traceable information out on the internet in usenet is just
> asking for trouble. in a way, i'm warning him not to be stupid...despite his
> ignorance to all other such warnings to date.
>

So we should not provide any link to the websites we are affiliated with
on the newsgroups, nor provide any link to test pages etc? all to
protect our whois data?

What kind of trouble is it really? Is some random usenet junkie going to
travel across states to cuss at me or the original poster for what is
on our site? How is a usenet ANY different than posting your website url
ANYWHERE on the internet? Usenet does not give you 'extra information'
from a whois result. It's no different than posting a url in your
signature of a forum, top link site, anything.

People build websites to be found and viewed. And here you are saying
you should NOT want people to know about your website. Do you even know
how the internet works?

You can not run an online website and expect to be 100% anonymous, nor
do you need to be.

BILLIONS of websites have whois information showing there personal
details. so millions of people are stupid for posting their website URL?
I really do not understand what you are getting at.

My email is a clear link to my web address (while its not my address, I
live 5 minutes away). Am I suppose to use a fake email address so people
wont find my site? Oh wait... no point in even running my site if people
don't find it...

>> And your trying to attack this guy for no reason, just because he wants to
>> auto play a php file?... You need to grow up, or leave the internet.
>
> no, it revolves around another thread. and, as the good professor still
> can't RTFM or think creatively, i'll continue to harrass him.
>

Ok, so you have a personal dislike of the OP from another post. Bringing
your problems to another thread is what we call 'trolling'. Grow up.

To the OP:

You may also use



That outputs a random entry from an array, and much simpler code than
anything shown above and gets the job done.



--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel@fanetworks.net

Re: Random BGSOUND script

am 16.01.2008 01:59:00 von Steve

"Daniel Ennis" wrote in message
news:02cde92b$0$21714$c3e8da3@news.astraweb.com...
> Steve wrote:
>
>>> Um, are you 12? Welcome to the internet. Whois records isn't nothing
>>> special...
>>
>> no, but putting traceable information out on the internet in usenet is
>> just asking for trouble. in a way, i'm warning him not to be
>> stupid...despite his ignorance to all other such warnings to date.
>>
>
> So we should not provide any link to the websites we are affiliated with
> on the newsgroups, nor provide any link to test pages etc? all to protect
> our whois data?

no, to protect the person defined in said data.

> What kind of trouble is it really? Is some random usenet junkie going to
> travel across states to cuss at me or the original poster for what is on
> our site? How is a usenet ANY different than posting your website url
> ANYWHERE on the internet? Usenet does not give you 'extra information'
> from a whois result. It's no different than posting a url in your
> signature of a forum, top link site, anything.

you mean, what kind of things could be done with that information? lots.
and, the difference with usenet is that it is generally a breeding grounds
for flame wars. there is a lot of incentive to invoke some very nasty things
on a person who has pissed you off. finally, most of the nastier stuff i can
think of doing, i can do at arm's reach just using the internet.

> People build websites to be found and viewed. And here you are saying you
> should NOT want people to know about your website. Do you even know how
> the internet works?

is that why? hmmm, i never thought of that. :)

> You can not run an online website and expect to be 100% anonymous, nor do
> you need to be.

i can *absolutely* run an online website and be 100% anonymous...unless you
can compel my isp to give you account information linked with my ip address.

> BILLIONS of websites have whois information showing there personal
> details. so millions of people are stupid for posting their website URL? I
> really do not understand what you are getting at.

you're very naive.

> My email is a clear link to my web address (while its not my address, I
> live 5 minutes away). Am I suppose to use a fake email address so people
> wont find my site? Oh wait... no point in even running my site if people
> don't find it...

totally naive.

>>> And your trying to attack this guy for no reason, just because he wants
>>> to auto play a php file?... You need to grow up, or leave the internet.
>>
>> no, it revolves around another thread. and, as the good professor still
>> can't RTFM or think creatively, i'll continue to harrass him.
>>
>
> Ok, so you have a personal dislike of the OP from another post. Bringing
> your problems to another thread is what we call 'trolling'. Grow up.

yep...and trolling can be fun. plus, fred provides much food and to such a
degree that others can't help but chuckle.

> To the OP:
>
> You may also use
>
>
>
> That outputs a random entry from an array, and much simpler code than
> anything shown above and gets the job done.

not as efficient if the operation is in a loop and/or if the array is of
substance, i.e. large. still, for this example, good call.