Pseudorandom integer sequence having at least 15 adjacent differences > 36

In summary: Randomly shuffle the 50 numbers.4. Add 36 to each of the first 15 numbers.5. Repeat steps 3 and 4 for a desired number of iterations.This algorithm will likely result in a more random sequence with the required number of adjacent differences greater than 36. Additionally, it is more efficient as it does not require repeatedly selecting random numbers until the requirement is met.
  • #1
tcma
1
0
The requirement is to find an pseudorandom integer sequence i0, i1, i2, i3, ... , i48, i49 so that there are at least 15 adjacent differences which are greater than 36.
Code:
Adjacent difference = absolute value of the difference between two adjacent integers
= |i  - i   |  where j = 0 to 49 
  | j -  j+1|
and
 i  =  an integer in the range of [1, 2, 3, ..., 50]
  j
= an integer in the range of [1, 2, 3, ..., 50]

e.g.
For this integer sequence (very poor in randomness)
1 39 2 40 3 41 4 42 5 43 6 44 7 45 8 46 9 47 10 48 11 49 12 50 13 26 14 27 15 28 16 29 17 30 18 31 19 32 20 33 21 34 22 35 23 36 24 37 25 38 i0 = 1
i1 = 39
i2 = 2
i3 = 40
i4 = 3
...
i47 = 37
i48 = 25
i49 = 38

Adjacent difference
|i0 - i1| = |1 - 39| = 38
|i1 - i2| = |39 - 2| = 37
|i2 - i3| = |2 - 40| = 38
|i3 - i4| = |40 - 3| = 37
...
|i23 - i24| = |50 - 13| = 37
|i24 - i25| = |13 - 26| = 13
...
|i46 - i47| = |24 - 37| = 13
|i47 - i48| = |37 - 25| = 12
|i48 - i49| = |25 - 38| = 13

There are 24 adjacent differences which are greater than 36.
Is there an algorithm to find an pseudorandom integer sequence which meet the requirement?
One algorithm I can think of is:
1. Create a not-random integer sequence which has at least 15 adjacent differences which are greater than 36.
e.g. the above integer sequence alternates between a small and large integer
2. Randomlly select two odd-indexed integer.
If swapping them still meet the requirement, then swap them
3. Randomlly select two even-indexed integer.
If swapping them still meet the requirement, then swap them
4. Repeat steps 2 and 3 many times

I will write a computer program to implement this.
Please comment or suggest a better algorithm.
 
Last edited:
Physics news on Phys.org
  • #2
I suggest the following:
1. Choose 50 numbers at random.
2.Pick up any 15 of them at random & add 36 to each of them.
This ensures the size of the difference, keeping as much randomness as possible.
 

Related to Pseudorandom integer sequence having at least 15 adjacent differences > 36

1. What is a pseudorandom integer sequence?

A pseudorandom integer sequence is a sequence of numbers that appears to be random but is actually generated by a deterministic algorithm. This means that the numbers are not truly random, but they are difficult to predict without knowing the algorithm used to generate them.

2. What is the significance of having at least 15 adjacent differences > 36 in a pseudorandom integer sequence?

This means that there are at least 15 consecutive pairs of numbers in the sequence that have a difference of 36 or more. This can indicate a higher level of randomness in the sequence, as larger differences between adjacent numbers are less predictable.

3. How is the randomness of a pseudorandom integer sequence measured?

There are several statistical tests that can be used to measure the randomness of a sequence, such as the Chi-square test, the Kolmogorov-Smirnov test, and the Runs test. These tests analyze the frequency and distribution of numbers in the sequence to determine how closely it resembles a truly random sequence.

4. What factors can affect the randomness of a pseudorandom integer sequence?

The algorithm used to generate the sequence, the seed value chosen, and the length of the sequence can all impact the randomness of a pseudorandom integer sequence. A poorly designed algorithm or a limited range of possible values can result in a less random sequence.

5. How are pseudorandom integer sequences used in scientific research?

Pseudorandom integer sequences are commonly used in simulations and modeling in various fields of science, such as mathematics, physics, and computer science. They can also be used in cryptography, where a high level of randomness is necessary for secure communication and data encryption.

Similar threads

Replies
3
Views
2K
Replies
7
Views
6K
Replies
16
Views
5K
Replies
18
Views
12K
Replies
7
Views
4K
Replies
6
Views
2K
Replies
2
Views
2K
Replies
19
Views
1K
Replies
12
Views
2K
Back
Top