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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:44:23+00:00 2026-06-11T20:44:23+00:00

I am new to python and one of the problems I am working on

  • 0

I am new to python and one of the problems I am working on is to plot 500 pairs of successive random numbers. I have a formula that generates the numbers seen below:

x-axis

>>> a=128
>>> c=0
>>> m=509
>>> n=500
>>> seed = 10
>>> for i in range (1,n):
    new_seed=(a*seed+c)%m
    seed = new_seed
    print new_seed

y-axis

>>> a=269
>>> c=0
>>> m=2048
>>> n=500
>>> seed = 10
>>> for i in range (1,n):
    new_seed=(a*seed+c)%m
    seed = new_seed
    print new_seed

What I am wondering now is how I can turn these results into an array or list. I have attempted to put plt.plot(new_seed) in the loop statement but that did not work when I tried to plot. Any ideas?

I used import matplotlib.pyplot as plt

Thanks in advance for the help!!

  • 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-06-11T20:44:24+00:00Added an answer on June 11, 2026 at 8:44 pm

    You should probably do some (more)python tutorials.. lists are a fundamental aspect of python and it seems you dont understand them…

    import matplotlib.pyplot as plt
    import random
    x = []
    a,seed,c,m,n = 128,10,0,509,500
    for i in range (1,n):
       new_seed=(a*seed+c)%m
       seed = new_seed
       x.append( new_seed)
    
    
    a,seed,c,m,n = 269,10,0,2048,500
    y= []
    for i in range (1,n):
       new_seed=(a*seed+c)%m
       seed = new_seed
       y.append( new_seed)
    plt.plot(x,y)
    plt.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very new to python and can't understand why this isn't working. I have a
I'm very new to Python development, and am having a problem with one of
I'm somewhat new to C++, coming from python. One piece of functionality I really
New to Python, have a simple, situational question: Trying to use BeautifulSoup to parse
I am new to Python and have been studying its fundementals for 3 months
I'm a new to Python. I have installed Python 2.7 64 bit on Win7
I'm fairly new to Python, and I've just started working with XML parsing. I
I'm working on a python script that opens a logfile, writes specific information to
I am reasonably new to the inner workings of Python. I have been trying
I'm new to Python and running into a heap of problems and I need

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.