File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
1
# To create a shuffled array. Generate a pseudo random number
2
- # Swap that number with any other element in the list run this swapping len(Array)
2
+ # Swap that number with str_square_seed other element in the list run this swapping len(Array)
3
3
# times to get desired shuffled array
4
4
5
5
# To Understand more of random number generation
@@ -33,13 +33,13 @@ def pseudo_random_number_generator(self, num: int) -> int:
33
33
if num == 1 :
34
34
return 0
35
35
self .seed *= self .seed
36
- any = str (self .seed )
37
- if any != "0" :
38
- self .seed = int (any [- 1 :- 5 :- 1 ])
36
+ str_square_seed = str (self .seed )
37
+ if str_square_seed != "0" :
38
+ self .seed = int (str_square_seed [- 1 :- 5 :- 1 ])
39
39
else :
40
- any = any [:] + str (len (self .arr ) // 2 )
41
- if int (any [- 1 ]) < num :
42
- return int (any [- 1 ])
40
+ str_square_seed = str_square_seed [:] + str (len (self .arr ) // 2 )
41
+ if int (str_square_seed [- 1 ]) < num :
42
+ return int (str_square_seed [- 1 ])
43
43
return self .pseudo_random_number_generator (num )
44
44
45
45
def reset (self ) -> list :
You can’t perform that action at this time.
0 commit comments