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 511435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:12:59+00:00 2026-05-13T07:12:59+00:00

I created a jQuery plugin but I have a problem, I use the following

  • 0

I created a jQuery plugin but I have a problem, I use the following code:

Math.floor(Math.random()*500)

I add the result to a element,
but bizarrely the result is every time the same.

If I add a alert() to the line after the random-number-generation,
I get random values, why?
I want to get without the alert() random integers. But how?

  • 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-13T07:12:59+00:00Added an answer on May 13, 2026 at 7:12 am

    The random number function is an equation that simulates being random, but, it is still a function. If you give it the same seed the first answer will be the same.

    You could try changing the seed, and do this when the javascript is first loaded, so that if there is a time component to the random number generator, then it can use the delays of pages being loaded to randomize the numbers more.

    But, you may want to change the seed. You can use the Date() function, then get the milliseconds and use that as the seed, and that may help to scramble it up first.

    My thought that there is a time component to the generator is the fact that it changes with an alert, as that will delay when the next number is generated, though I haven’t tested this out.

    UPDATE:

    I realize the specification states that there is no parameter for Math.random, but there is a seed being used.

    I came at this from C and then Java, so the fact that there was no error using an argument led me to think it used it, but now I see that that was incorrect.

    If you really need a seed, your best bet is to write a random number generator, and then Knuth books are the best starting point for that.

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

Sidebar

Ask A Question

Stats

  • Questions 245k
  • Answers 245k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm sorry for you but the flash hash is not… May 13, 2026 at 8:12 am
  • Editorial Team
    Editorial Team added an answer Is something like this what you're looking for? TestClass.testColor =… May 13, 2026 at 8:12 am
  • Editorial Team
    Editorial Team added an answer I think your while r.include logic is the wrong way… May 13, 2026 at 8:12 am

Related Questions

I'm using Joomla 1.5. I have created a custom component that pulls data out
I'm playing around with writing a jQuery plugin that uses an attribute to define
I use html attribute title to set some hints like this: <a href... title=Go
I am using the jQuery Tools Scrollable plugin - http://flowplayer.org/tools/scrollable.html#navigator I have created a
I am trying to create a form with many groups containing many radio buttons.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.