Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

random numbers

random numbers

random numbers

I need to get a series of random numbers which are alldifferant to each other, in a given range. However i need my script to return the same series of random numbers given the same information passed from a form.

RE: random numbers

What kind of information is passed from the form?


RE: random numbers

The form passes the day, month, year, a lucky number and a lucky word, so on a given day the user should be able to enter the same word and number and get the same random numbers.

RE: random numbers

Ok. Look in the perlfunc man page for the srand function - this starts off the perl random number generator at a certain point.

Think of the date as a number like this: 19993108

and a word as a series of numbers - the ascii value of those characters - add all these values together.

Add the date number to the value you got from adding the ascii values of the lucky word (and your lucky number) and use that result to initialise (to "seed" - they call it) the random number generator.

That should give you a starting point.

Interesting. People normally want to know how make thier "random" series of numbers *truly* random - much more difficult.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close