Find the answer to your Linux question:
Results 1 to 5 of 5
hi all, how to use RANDOM function in bash? for example i have couple words: vegas*harrahs, venture capital, viagra, v1agra, vi@gra, vi*agra, viagr@, vicodin, video professor, violence, vioxx, virginity*, virus ...
  1. #1
    Just Joined!
    Join Date
    Aug 2006
    Posts
    32

    random function

    hi all,

    how to use RANDOM function in bash?
    for example i have couple words:
    vegas*harrahs, venture capital, viagra, v1agra, vi@gra, vi*agra,
    viagr@, vicodin, video professor, violence, vioxx, virginity*, virus alert,
    virus detected

    and i want to use RANDOm function to create as many possible words there can be plus using numbers 0-9.

    I want to create database for keyword filtering in exchange.
    thanks

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    If you want to do keyword filtering, you don't want to generate words using the random function. You want to permute through all possible combinations, omitting none.

    And even that would likely produce more words than you could conveniently store. This problem does not scale well.

    No, the only reason you would want to use a random function would be if you were trying to generate spam in the first place.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Aug 2006
    Posts
    32

    re

    that is one of two answers that i was afraid of that someone might give me.
    but that's ok.

  4. #4
    Just Joined!
    Join Date
    Aug 2006
    Posts
    32
    so how can i permute through all possible combinations, omitting none ??


    thanks

  5. #5
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    For help on bash string manipulation, google this:
    Code:
    bash tutorial substring
    But the best thing to do before even starting this project is ask yourself whether it's even feasible: Do you have any idea how many words you are going to produce? Billions and billions. Where are you going to store them all? How would you access one of them?

    As previously mentioned, this project does not scale well. Unless you only want one or two for the purpose of producing spam, and you've already said that you're not doing that.

    Producing spam is the only context in which this adventure makes any sense.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...