Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4085568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:35:52+00:00 2026-05-20T18:35:52+00:00

How does the value produced by rand function depends on it seed value.When we

  • 0

How does the value produced by rand function depends on it seed value.When we do not define any seed then how does its values differ.
Below is a code that i found for generating numbers for an integer array can any one please explain :

#!/usr/bin/perl -w

  # Linear search of an array

  # Note that if you later on want to search for something from a
  # list of values, you shouldn’t have used an array in the first
  # place.

  # Generating 10 integers
  $NUM = 10;
  $MAXINT = 100; # 1 + the maximum integer generated

  srand(); # initialize the randomize seed

  print "Numbers Generated:\n(";
  for $i (1 .. $NUM) {
  push @array, sprintf("%d", rand(1) * $MAXINT);
  print $array[$i-1];
  print ", " unless ($i == $NUM);
  }
  print ")\n\n";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:35:52+00:00Added an answer on May 20, 2026 at 6:35 pm

    As far as I know perl uses the pseudo-random number generation functions of the standard C library.
    It may depend on the implementation but it usually is a Linear Congruential Generator. This kind of PRNG uses its previous value to generate the next, therefore it will need a start value aka the seed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does any one have a preference on how to check if a value is
Why does the JavaScript function encodeURIComponent encode spaces to the hex Unicode value %20
The method Concat() does not modify the original value. It returns a new value.
Does SQLite support seeding the RANDOM() function the same way MySQL does with RAND()
Does anyone know what this value is for? If it is set to 1,
Does anyone know how to transform a enum value to a human readable value?
does anyone know how to return a value from a (sql) database into an
Does anybody knows how can I get the max and min value of the
Does anybody know of a convenient means of determining if a string value qualifies
Why does the compiler say a constant value is required for the first case...the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.