We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fcf5c08 commit 849d6acCopy full SHA for 849d6ac
2 files changed
.gitignore
@@ -2,3 +2,4 @@ __pycache__/
2
build/
3
dist/
4
java_stream.egg-info/
5
+main.py
stream/stream.py
@@ -1,4 +1,5 @@
1
from functools import cmp_to_key
+import random
from .iterators import IteratorUtils
from .optional import Optional
@@ -96,6 +97,17 @@ def concat(*streams):
96
97
'''
98
return Stream(IteratorUtils.concat(*streams))
99
100
+ @staticmethod
101
+ def randint(lower, upper):
102
+ '''
103
+ Returns an infinite stream of random integer in range [a, b], including both end points.
104
+
105
+ :param int lower: min value for random numbers
106
+ :param int upper: max value for random numbers
107
+ :return: the infinite random stream
108
109
+ return Stream.generate(lambda: random.randint(lower, upper))
110
111
"""
112
Normal Methods
113
0 commit comments