We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
f
numpy.random.f function

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ivy/functional/frontends/numpy/random/functions.py`
Content:
```
1 # local
2 import ivy
3 from ivy.functional.frontends.numpy.func_wrapper import (
4     to_ivy_arrays_and_back,
5     from_zero_dim_arrays_to_scalar,
6 )
7 
8 
9 @to_ivy_arrays_and_back
10 @from_zero_dim_arrays_to_scalar
11 def random_sample(size=None):
12     return ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
13 
14 
15 @to_ivy_arrays_and_back
16 @from_zero_dim_arrays_to_scalar
17 def dirichlet(alpha, size=None):
18     return ivy.dirichlet(alpha, size=size)
19 
20 
21 @to_ivy_arrays_and_back
22 @from_zero_dim_arrays_to_scalar
23 def uniform(low=0.0, high=1.0, size=None):
24     return ivy.random_uniform(low=low, high=high, shape=size, dtype="float64")
25 
26 
27 @to_ivy_arrays_and_back
28 @from_zero_dim_arrays_to_scalar
29 def geometric(p, size=None):
30     if p < 0 or p > 1:
31         raise ValueError("p must be in the interval [0, 1]")
32     oneMinusP = ivy.subtract(1, p)
33     sizeMinusOne = ivy.subtract(size, 1)
34 
35     return ivy.multiply(ivy.pow(oneMinusP, sizeMinusOne), p)
36 
37 
38 @to_ivy_arrays_and_back
39 @from_zero_dim_arrays_to_scalar
40 def normal(loc=0.0, scale=1.0, size=None):
41     return ivy.random_normal(mean=loc, std=scale, shape=size, dtype="float64")
42 
43 
44 @to_ivy_arrays_and_back
45 @from_zero_dim_arrays_to_scalar
46 def poisson(lam=1.0, size=None):
47     return ivy.poisson(lam=lam, shape=size)
48 
49 
50 @to_ivy_arrays_and_back
51 @from_zero_dim_arrays_to_scalar
52 def multinomial(n, pvals, size=None):
53     assert not ivy.exists(size) or (len(size) > 0 and len(size) < 3)
54     batch_size = 1
55     if ivy.exists(size):
56         if len(size) == 2:
57             batch_size = size[0]
58             num_samples = size[1]
59         else:
60             num_samples = size[0]
61     else:
62         num_samples = len(pvals)
63     return ivy.multinomial(n, num_samples, batch_size=batch_size, probs=pvals)
64 
65 
66 @to_ivy_arrays_and_back
67 @from_zero_dim_arrays_to_scalar
68 def permutation(x, /):
69     if isinstance(x, int):
70         x = ivy.arange(x)
71     return ivy.shuffle(x)
72 
73 
74 @to_ivy_arrays_and_back
75 @from_zero_dim_arrays_to_scalar
76 def beta(a, b, size=None):
77     return ivy.beta(a, b, shape=size)
78 
79 
80 @to_ivy_arrays_and_back
81 @from_zero_dim_arrays_to_scalar
82 def shuffle(x, axis=0, /):
83     if isinstance(x, int):
84         x = ivy.arange(x)
85     return ivy.shuffle(x, axis)
86 
87 
88 @to_ivy_arrays_and_back
89 @from_zero_dim_arrays_to_scalar
90 def standard_normal(size=None):
91     return ivy.random_normal(mean=0.0, std=1.0, shape=size, dtype="float64")
92 
93 
94 @to_ivy_arrays_and_back
95 @from_zero_dim_arrays_to_scalar
96 def standard_gamma(shape, size=None):
97     return ivy.gamma(shape, 1.0, shape=size, dtype="float64")
98 
99 
100 @to_ivy_arrays_and_back
101 @from_zero_dim_arrays_to_scalar
102 def binomial(n, p, size=None):
103     if p < 0 or p > 1:
104         raise ValueError("p must be in the interval (0, 1)")
105     if n < 0:
106         raise ValueError("n must be strictly positive")
107     if size is None:
108         size = 1
109     else:
110         size = size
111     if isinstance(size, int):
112         size = (size,)
113     lambda_ = ivy.multiply(n, p)
114     return ivy.poisson(lambda_, shape=size)
115 
116 
117 @to_ivy_arrays_and_back
118 @from_zero_dim_arrays_to_scalar
119 def chisquare(df, size=None):
120     df = ivy.array(df)  # scalar ints and floats are also array_like
121     if ivy.any(df <= 0):
122         raise ValueError("df <= 0")
123 
124     # ivy.gamma() throws an error if both alpha is an array and a shape is passed
125     # so this part broadcasts df into the shape of `size`` first to keep it happy.
126     if size is not None:
127         df = df * ivy.ones(size)
128 
129     return ivy.gamma(df / 2, 2, dtype="float64")
130 
131 
132 @to_ivy_arrays_and_back
133 @from_zero_dim_arrays_to_scalar
134 def lognormal(mean=0.0, sigma=1.0, size=None):
135     ret = ivy.exp(ivy.random_normal(mean=mean, std=sigma, shape=size, dtype="float64"))
136     return ret
137 
138 
139 @to_ivy_arrays_and_back
140 @from_zero_dim_arrays_to_scalar
141 def negative_binomial(n, p, size=None):
142     if p <= 0 or p >= 1:
143         raise ValueError("p must be in the interval (0, 1)")
144     if n <= 0:
145         raise ValueError("n must be strictly positive")
146     # numpy implementation uses scale = (1 - p) / p
147     scale = (1 - p) / p
148     # poisson requires shape to be a tuple
149     if isinstance(size, int):
150         size = (size,)
151     lambda_ = ivy.gamma(n, scale, shape=size)
152     return ivy.poisson(lam=lambda_, shape=size)
153 
154 
155 @to_ivy_arrays_and_back
156 @from_zero_dim_arrays_to_scalar
157 def weibull(a, size=None):
158     if a < 0:
159         return 0
160     u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
161     return ivy.pow(-ivy.log(1 - u), 1 / a)
162 
163 
164 @to_ivy_arrays_and_back
165 @from_zero_dim_arrays_to_scalar
166 def standard_cauchy(size=None):
167     u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
168     return ivy.tan(ivy.pi * (u - 0.5))
169 
170 
171 @to_ivy_arrays_and_back
172 @from_zero_dim_arrays_to_scalar
173 def rayleigh(scale, size=None):
174     u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
175     log_u = ivy.log(u)
176     x = ivy.multiply(scale, ivy.sqrt(ivy.multiply(-2, log_u)))
177     return x
178 
179 
180 @to_ivy_arrays_and_back
181 @from_zero_dim_arrays_to_scalar
182 def gumbel(loc=0.0, scale=1.0, size=None):
183     u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
184     x = loc - scale * ivy.log(-ivy.log(u))
185     return x
186 
187 
188 @to_ivy_arrays_and_back
189 @from_zero_dim_arrays_to_scalar
190 def gamma(shape, scale=1.0, size=None):
191     return ivy.gamma(shape, scale, shape=size, dtype="float64")
192 
193 
194 @to_ivy_arrays_and_back
195 @from_zero_dim_arrays_to_scalar
196 def logistic(loc=0.0, scale=1.0, size=None):
197     u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype="float64")
198     x = loc + scale * ivy.log(u / (1 - u))
199     return x
200 
201 
202 @to_ivy_arrays_and_back
203 @from_zero_dim_arrays_to_scalar
204 def triangular(left, mode, right, size=None):
205     if left > mode or mode > right or left == right:
206         raise ivy.utils.exceptions.IvyValueError(
207             "left < mode < right is not being followed"
208         )
209     u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
210     condition = u <= (mode - left) / (right - left)
211     values1 = left + (right - left) * (u * (mode - left) / (right - left)) ** 0.5
212     values2 = (
213         right - (right - mode) * ((1 - u) * (right - mode) / (right - left)) ** 0.5
214     )
215     return ivy.where(condition, values1, values2)
216
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ivy/functional/frontends/numpy/random/functions.py b/ivy/functional/frontends/numpy/random/functions.py
--- a/ivy/functional/frontends/numpy/random/functions.py
+++ b/ivy/functional/frontends/numpy/random/functions.py
@@ -185,6 +185,17 @@
     return x
 
 
+@to_ivy_arrays_and_back
+@from_zero_dim_arrays_to_scalar
+def f(dfn, dfd, size=None):
+    # Generate samples from the uniform distribution
+    x1 = ivy.gamma(ivy.to_scalar(ivy.divide(dfn, 2)), 2.0, shape=size, dtype="float64")
+    x2 = ivy.gamma(ivy.to_scalar(ivy.divide(dfd, 2)), 2.0, shape=size, dtype="float64")
+    # Calculate the F-distributed samples
+    samples = ivy.divide(ivy.divide(x1, ivy.array(dfn)), ivy.divide(x2, ivy.array(dfd)))
+    return samples
+
+
 @to_ivy_arrays_and_back
 @from_zero_dim_arrays_to_scalar
 def gamma(shape, scale=1.0, size=None):

{"golden_diff": "diff --git a/ivy/functional/frontends/numpy/random/functions.py b/ivy/functional/frontends/numpy/random/functions.py\n--- a/ivy/functional/frontends/numpy/random/functions.py\n+++ b/ivy/functional/frontends/numpy/random/functions.py\n@@ -185,6 +185,17 @@\n     return x\n \n \n+@to_ivy_arrays_and_back\n+@from_zero_dim_arrays_to_scalar\n+def f(dfn, dfd, size=None):\n+    # Generate samples from the uniform distribution\n+    x1 = ivy.gamma(ivy.to_scalar(ivy.divide(dfn, 2)), 2.0, shape=size, dtype=\"float64\")\n+    x2 = ivy.gamma(ivy.to_scalar(ivy.divide(dfd, 2)), 2.0, shape=size, dtype=\"float64\")\n+    # Calculate the F-distributed samples\n+    samples = ivy.divide(ivy.divide(x1, ivy.array(dfn)), ivy.divide(x2, ivy.array(dfd)))\n+    return samples\n+\n+\n @to_ivy_arrays_and_back\n @from_zero_dim_arrays_to_scalar\n def gamma(shape, scale=1.0, size=None):\n", "issue": "f\nnumpy.random.f function\n", "before_files": [{"content": "# local\nimport ivy\nfrom ivy.functional.frontends.numpy.func_wrapper import (\n    to_ivy_arrays_and_back,\n    from_zero_dim_arrays_to_scalar,\n)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef random_sample(size=None):\n    return ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef dirichlet(alpha, size=None):\n    return ivy.dirichlet(alpha, size=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef uniform(low=0.0, high=1.0, size=None):\n    return ivy.random_uniform(low=low, high=high, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef geometric(p, size=None):\n    if p < 0 or p > 1:\n        raise ValueError(\"p must be in the interval [0, 1]\")\n    oneMinusP = ivy.subtract(1, p)\n    sizeMinusOne = ivy.subtract(size, 1)\n\n    return ivy.multiply(ivy.pow(oneMinusP, sizeMinusOne), p)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef normal(loc=0.0, scale=1.0, size=None):\n    return ivy.random_normal(mean=loc, std=scale, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef poisson(lam=1.0, size=None):\n    return ivy.poisson(lam=lam, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef multinomial(n, pvals, size=None):\n    assert not ivy.exists(size) or (len(size) > 0 and len(size) < 3)\n    batch_size = 1\n    if ivy.exists(size):\n        if len(size) == 2:\n            batch_size = size[0]\n            num_samples = size[1]\n        else:\n            num_samples = size[0]\n    else:\n        num_samples = len(pvals)\n    return ivy.multinomial(n, num_samples, batch_size=batch_size, probs=pvals)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef permutation(x, /):\n    if isinstance(x, int):\n        x = ivy.arange(x)\n    return ivy.shuffle(x)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef beta(a, b, size=None):\n    return ivy.beta(a, b, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef shuffle(x, axis=0, /):\n    if isinstance(x, int):\n        x = ivy.arange(x)\n    return ivy.shuffle(x, axis)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_normal(size=None):\n    return ivy.random_normal(mean=0.0, std=1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_gamma(shape, size=None):\n    return ivy.gamma(shape, 1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef binomial(n, p, size=None):\n    if p < 0 or p > 1:\n        raise ValueError(\"p must be in the interval (0, 1)\")\n    if n < 0:\n        raise ValueError(\"n must be strictly positive\")\n    if size is None:\n        size = 1\n    else:\n        size = size\n    if isinstance(size, int):\n        size = (size,)\n    lambda_ = ivy.multiply(n, p)\n    return ivy.poisson(lambda_, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef chisquare(df, size=None):\n    df = ivy.array(df)  # scalar ints and floats are also array_like\n    if ivy.any(df <= 0):\n        raise ValueError(\"df <= 0\")\n\n    # ivy.gamma() throws an error if both alpha is an array and a shape is passed\n    # so this part broadcasts df into the shape of `size`` first to keep it happy.\n    if size is not None:\n        df = df * ivy.ones(size)\n\n    return ivy.gamma(df / 2, 2, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef lognormal(mean=0.0, sigma=1.0, size=None):\n    ret = ivy.exp(ivy.random_normal(mean=mean, std=sigma, shape=size, dtype=\"float64\"))\n    return ret\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef negative_binomial(n, p, size=None):\n    if p <= 0 or p >= 1:\n        raise ValueError(\"p must be in the interval (0, 1)\")\n    if n <= 0:\n        raise ValueError(\"n must be strictly positive\")\n    # numpy implementation uses scale = (1 - p) / p\n    scale = (1 - p) / p\n    # poisson requires shape to be a tuple\n    if isinstance(size, int):\n        size = (size,)\n    lambda_ = ivy.gamma(n, scale, shape=size)\n    return ivy.poisson(lam=lambda_, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef weibull(a, size=None):\n    if a < 0:\n        return 0\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    return ivy.pow(-ivy.log(1 - u), 1 / a)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_cauchy(size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    return ivy.tan(ivy.pi * (u - 0.5))\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef rayleigh(scale, size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    log_u = ivy.log(u)\n    x = ivy.multiply(scale, ivy.sqrt(ivy.multiply(-2, log_u)))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef gumbel(loc=0.0, scale=1.0, size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    x = loc - scale * ivy.log(-ivy.log(u))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef gamma(shape, scale=1.0, size=None):\n    return ivy.gamma(shape, scale, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef logistic(loc=0.0, scale=1.0, size=None):\n    u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype=\"float64\")\n    x = loc + scale * ivy.log(u / (1 - u))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef triangular(left, mode, right, size=None):\n    if left > mode or mode > right or left == right:\n        raise ivy.utils.exceptions.IvyValueError(\n            \"left < mode < right is not being followed\"\n        )\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    condition = u <= (mode - left) / (right - left)\n    values1 = left + (right - left) * (u * (mode - left) / (right - left)) ** 0.5\n    values2 = (\n        right - (right - mode) * ((1 - u) * (right - mode) / (right - left)) ** 0.5\n    )\n    return ivy.where(condition, values1, values2)\n", "path": "ivy/functional/frontends/numpy/random/functions.py"}], "after_files": [{"content": "# local\nimport ivy\nfrom ivy.functional.frontends.numpy.func_wrapper import (\n    to_ivy_arrays_and_back,\n    from_zero_dim_arrays_to_scalar,\n)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef random_sample(size=None):\n    return ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef dirichlet(alpha, size=None):\n    return ivy.dirichlet(alpha, size=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef uniform(low=0.0, high=1.0, size=None):\n    return ivy.random_uniform(low=low, high=high, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef geometric(p, size=None):\n    if p < 0 or p > 1:\n        raise ValueError(\"p must be in the interval [0, 1]\")\n    oneMinusP = ivy.subtract(1, p)\n    sizeMinusOne = ivy.subtract(size, 1)\n\n    return ivy.multiply(ivy.pow(oneMinusP, sizeMinusOne), p)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef normal(loc=0.0, scale=1.0, size=None):\n    return ivy.random_normal(mean=loc, std=scale, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef poisson(lam=1.0, size=None):\n    return ivy.poisson(lam=lam, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef multinomial(n, pvals, size=None):\n    assert not ivy.exists(size) or (len(size) > 0 and len(size) < 3)\n    batch_size = 1\n    if ivy.exists(size):\n        if len(size) == 2:\n            batch_size = size[0]\n            num_samples = size[1]\n        else:\n            num_samples = size[0]\n    else:\n        num_samples = len(pvals)\n    return ivy.multinomial(n, num_samples, batch_size=batch_size, probs=pvals)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef permutation(x, /):\n    if isinstance(x, int):\n        x = ivy.arange(x)\n    return ivy.shuffle(x)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef beta(a, b, size=None):\n    return ivy.beta(a, b, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef shuffle(x, axis=0, /):\n    if isinstance(x, int):\n        x = ivy.arange(x)\n    return ivy.shuffle(x, axis)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_normal(size=None):\n    return ivy.random_normal(mean=0.0, std=1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_gamma(shape, size=None):\n    return ivy.gamma(shape, 1.0, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef binomial(n, p, size=None):\n    if p < 0 or p > 1:\n        raise ValueError(\"p must be in the interval (0, 1)\")\n    if n < 0:\n        raise ValueError(\"n must be strictly positive\")\n    if size is None:\n        size = 1\n    else:\n        size = size\n    if isinstance(size, int):\n        size = (size,)\n    lambda_ = ivy.multiply(n, p)\n    return ivy.poisson(lambda_, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef chisquare(df, size=None):\n    df = ivy.array(df)  # scalar ints and floats are also array_like\n    if ivy.any(df <= 0):\n        raise ValueError(\"df <= 0\")\n\n    # ivy.gamma() throws an error if both alpha is an array and a shape is passed\n    # so this part broadcasts df into the shape of `size`` first to keep it happy.\n    if size is not None:\n        df = df * ivy.ones(size)\n\n    return ivy.gamma(df / 2, 2, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef lognormal(mean=0.0, sigma=1.0, size=None):\n    ret = ivy.exp(ivy.random_normal(mean=mean, std=sigma, shape=size, dtype=\"float64\"))\n    return ret\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef negative_binomial(n, p, size=None):\n    if p <= 0 or p >= 1:\n        raise ValueError(\"p must be in the interval (0, 1)\")\n    if n <= 0:\n        raise ValueError(\"n must be strictly positive\")\n    # numpy implementation uses scale = (1 - p) / p\n    scale = (1 - p) / p\n    # poisson requires shape to be a tuple\n    if isinstance(size, int):\n        size = (size,)\n    lambda_ = ivy.gamma(n, scale, shape=size)\n    return ivy.poisson(lam=lambda_, shape=size)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef weibull(a, size=None):\n    if a < 0:\n        return 0\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    return ivy.pow(-ivy.log(1 - u), 1 / a)\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef standard_cauchy(size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    return ivy.tan(ivy.pi * (u - 0.5))\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef rayleigh(scale, size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    log_u = ivy.log(u)\n    x = ivy.multiply(scale, ivy.sqrt(ivy.multiply(-2, log_u)))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef gumbel(loc=0.0, scale=1.0, size=None):\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    x = loc - scale * ivy.log(-ivy.log(u))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef f(dfn, dfd, size=None):\n    # Generate samples from the uniform distribution\n    x1 = ivy.gamma(ivy.to_scalar(ivy.divide(dfn, 2)), 2.0, shape=size, dtype=\"float64\")\n    x2 = ivy.gamma(ivy.to_scalar(ivy.divide(dfd, 2)), 2.0, shape=size, dtype=\"float64\")\n    # Calculate the F-distributed samples\n    samples = ivy.divide(ivy.divide(x1, ivy.array(dfn)), ivy.divide(x2, ivy.array(dfd)))\n    return samples\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef gamma(shape, scale=1.0, size=None):\n    return ivy.gamma(shape, scale, shape=size, dtype=\"float64\")\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef logistic(loc=0.0, scale=1.0, size=None):\n    u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype=\"float64\")\n    x = loc + scale * ivy.log(u / (1 - u))\n    return x\n\n\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef triangular(left, mode, right, size=None):\n    if left > mode or mode > right or left == right:\n        raise ivy.utils.exceptions.IvyValueError(\n            \"left < mode < right is not being followed\"\n        )\n    u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype=\"float64\")\n    condition = u <= (mode - left) / (right - left)\n    values1 = left + (right - left) * (u * (mode - left) / (right - left)) ** 0.5\n    values2 = (\n        right - (right - mode) * ((1 - u) * (right - mode) / (right - left)) ** 0.5\n    )\n    return ivy.where(condition, values1, values2)\n", "path": "ivy/functional/frontends/numpy/random/functions.py"}]}