Forum Moderators: coopster & phranque

Message Too Old, No Replies

Program to write randomly.

         

toolman

3:03 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a script that will pull sentences from a file/db and randomly assemble them on a page?

rcjordan

3:14 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to clarify, all of the sentences each time?

toolman

3:20 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Say I write a bunch of good sentences about...oh...let's say real estate in Kansas. The I assemble each sentence on it's own delimited little line.

Is there a script that will take entire sentences and randomly write them to a page?

rcjordan

3:24 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Say you could somehow think up 10 things to say about real estate in Kansas, do you want to write all 10 of them each time in random order, or 1 of the 10 picked from the db at random?

toolman

4:03 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let's say I thought of 200 different sentences and I could set a limit for the file to be written to include a certain number of those sentences randomly selected. So I would end up with a page with 20 randomly selected sentences from the 200.

This make any sense?

rcjordan

4:34 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't get excited, I don't know of such a script (well, maybe an idea), but we may as well get the last part down.

>This make any sense?
>
Yes.

Q:
Are these 20 sentences to be created dynamically and rotated so that each time a visitor goes through the page he sees a different set of 20?

toolman

5:17 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope. Just need fodder for the cannon. It needs to write me a "unique page" just once before I ship it off into "Battlezone SEO" to wrestle algorithms and spiders all the days of its life.

littleman

5:24 am on Jun 23, 2001 (gmt 0)



Hey Tool,
It is very easy to do such a thing in perl. But you may want to read this thread [webmasterworld.com] before you decide to do it.

rcjordan

5:33 am on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Seems to me you could do this in something like Excel if there's a way to randomize the sort. Just cut & paste a block of 20 lines.

rcjordan

8:48 pm on Jun 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Went looking for the random story generator and stumbled across two scripts that seem likely prospects for use as-is or modified.
---------------------
Random sentence generator, really a random paragraph generator. Seems it would make a great keyword scrambler.

[kincsem.btf.hu...]
---------------------

A CGI random quiz generator. Teacher/admin may add to a pool of questions and multiple-choice/true-false answers with the admin interface. Through the use of cookies, students are randomly given a predetermined number of questions. Students won't get the same question more than once, and each student will see the questions in a different order.
[linguistic-funland.com...]

littleman

12:45 am on Jun 24, 2001 (gmt 0)



The problem with this is the double spider dipping and then page analyzing. If the page is off by X% on returning spider visits you could get flagged. You could use such a utility and then save the paragraphs for use on your pages, that would be a lot safer.

toolman

1:15 am on Jun 24, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry LM..thats what I was thinking all along. Static. I wonder where I can use such "gibberized" pages though?

littleman

1:19 am on Jun 24, 2001 (gmt 0)



You could cloak them.
hehe

Bolotomus

12:35 pm on Jul 11, 2001 (gmt 0)

10+ Year Member



Try this. Note that it might give duplicate lines in its output.

#!/usr/bin/perl -w
use strict;

my $textfile = "/home/me/myfile.txt"; # file with words/sentences, one per line
my $howmany = 20; # how many random picks to display

open (FILE,$textfile) ¦¦ die $!;
my(@lines)=<FILE>;
close FILE;

for (1..$howmany) { print $lines[int(rand()*scalar(@lines))] }