### Five pseudo random number generators

Assignment Help Basic Computer Science
##### Reference no: EM13935316

def __init__(self, seed=0): self.state = seed
def setSeed(self, seed): self.state = seed
def rand(self): return 1.0*self.next()/(1<<32)
def current(self): return self.state
def next(self):
self.state = (69069 * self.state + 12345) & 0xFFFFFFFF
return self.state

class rngB():
def __init__(self, seed=1): self.state = seed
def setSeed(self, seed): self.state = seed
def rand(self): return 1.0*self.next()/(1<<31)
def current(self): return self.state
def next(self):
self.state = (65539 * self.state + 4294967296) & 0x7FFFFFFF
return self.state

class rngC():
def __init__(self, seed=1): self.state = seed
def setSeed(self, seed): self.state = seed
def rand(self): return 1.0*self.next()/(1<<8)
def current(self): return self.state
def next(self):
self.state = ((((16339 * self.state>>4 + 1) & 0xFF) + 4294967296) & 0x7FFFFFFF)<<4
return self.state

class rngD():
def __init__(self, seed=1):
self.state = self.store = seed
def setSeed(self, seed): self.state = seed
def rand(self): return 1.0*self.next()/(1<<31)
def current(self): return self.state
def next(self):
self.store = self.state
self.state = (69069 * self.state + 12345) & 0xFFFFFFFF
self.state = int(.8*self.state+0.2*self.store)
return self.state

class rngE():
def __init__(self, seed=12345): self.state = seed
def setSeed(self, seed): self.state = seed
def rand(self): return 1.0*self.next()/(1<<31)
def current(self): return self.state
def next(self):
self.state = (397204094 * self.state ) & 0x7FFFFFFF
return self.state

- Evaluate the five pseudo random number generators (RNGs) supplied with respect to the quality of the generated random sequence. High quality random number generators are fundamental in ensuring reliable simulations.

Determine the criteria (set of tests) to be used in evaluating RNG.

Write a short report describing the given random number generators and the quality of their output.
1. Evaluate and rank in order of quality, the random number generators (RNGs) given A-E
2. To use the RNGs given you will need first to import the module
From rng import *
3. Create an instant of any of the generators using, rngA, rngB, rngC etc....using
rng = rngA (seed) where the argument (seed) is optional
4. To generate a random integer use rng.next ( )
But you will most probably want to generate floating point number in range [0 1) using
rng.rand ( )
: - import, create an instance, generate, => evaluate and rank => write a detailed report

#### Computer architectures class

From the first e-Activity, explain the key ways that your researched tools can be utilized in a Windows environment. Additionally, indicate which of these tools you would co

#### Programming visual basic

There are four major time zones in the continental United States: Eastern, Central, Mountain, and Pacific. Create a VB program that allows the user to enter the time for any

#### Remove all the cout statements from the constructor

Run the program written for Exercise 7a three times. On the first run, have your program simulate flipping the coin 10 times; the second run, 100 times; and the third run, 1

#### Why recompacting and relocation of files are often avoided

Consider a file system that uses inodes to represent files. Disk blocks are 8 KB in size, and a pointer to a disk block requires 4 bytes. This file system has 12 direct disk

#### What property does this sentence demonstrate

John said, "I saw the man in the park with a telescope." What did he mean? How many reasonable interpretations can you provide for this statement? List them. What property d

#### Smallest force p required to raise the bucket

The bucket has a mass of 20 kg and the coefficient of static friction between the pulley and the pin is µS=0.3 . Neglect the mass of the pulley and assume that the cable doe

#### Consumer demand helped managers develop the appropriate

In each of the following examples, describe how the information given about consumer demand helped managers develop the appropriate strategies to increase profitability and ho

#### Create a linked list of objects

1. Write a Java program that addresses a real world problem that needs a linked list. Create a linked list of objects (the object should be a realistic entity). Do NOT use t