fgs-dbudwin: Ok to test
fcurella: Thank you! ✨ 
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
index 7b1bd6f8..eb8a70a6 100644
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -60,7 +60,7 @@ class Provider(BaseProvider):
             if max_value is None:
                 max_value = min_value + self.random_int()
 
-            left_number = self.random_int(min_value, max_value)
+            left_number = self.random_int(min_value, max_value - 1)
         else:
             sign = '+' if positive else self.random_element(('+', '-'))
             left_number = self.random_number(left_digits)

pyfloat producing values above max_value
* Faker version: 2.0.1
* OS: Windows 10

Calling `pyfloat` with the `max_value` set can produce values above `max_value` leading to issues.

### Steps to reproduce

Run my example code below.

### Expected behavior

Given my following example, I would expect to _only_ see numbers in the range `1 <= x <= 2`.

```
for _ in range(25):
    print(faker.pyfloat(min_value=1, max_value=2))
```

### Actual behavior

However, my example will produce values in the range `1 <= x < 3`.  This behavior is very confusing and unexpected.  Output I got from running my above example:

```
1.200055
2.709
2.319785
2.773763416717
1.521
1.9
2.52454
2.91
1.87016
2.35457
1.92215
1.7
2.461453
1.922252943
1.416632
1.448
2.0
1.5
2.31
2.5114
2.18
1.8
2.12503540581
2.0
```

diff --git a/tests/test_factory.py b/tests/test_factory.py
index ddc8f3b0..110728cb 100644
--- a/tests/test_factory.py
+++ b/tests/test_factory.py
@@ -466,6 +466,16 @@ class FactoryTestCase(unittest.TestCase):
         with pytest.raises(ValueError):
             provider.pyfloat(left_digits=0, right_digits=0)
 
+    def test_pyfloat_in_range(self):
+        # tests for https://github.com/joke2k/faker/issues/994
+        factory = Faker()
+
+        factory.seed_instance(5)
+        result = factory.pyfloat(min_value=0, max_value=1)
+
+        assert result >= 0.0
+        assert result <= 1.0
+
     def test_negative_pyfloat(self):
         # tests for https://github.com/joke2k/faker/issues/813
         factory = Faker()

pip install -e .[dev]
parse_log_pytest
pytest
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio pytest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
execnet==2.1.1
-e git+https://github.com/joke2k/faker.git@78bf434d76d536553fb07777b41be0731d25b45e#egg=Faker
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
six==1.17.0
text-unidecode==1.3
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0

name: faker
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - execnet==2.1.1
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.9.0.post0
      - six==1.17.0
      - text-unidecode==1.3
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/faker

tests/test_factory.py::FactoryTestCase::test_pyfloat_in_range
tests/test_factory.py::FactoryTestCase::test_add_provider_gives_priority_to_newly_added_provider tests/test_factory.py::FactoryTestCase::test_binary tests/test_factory.py::FactoryTestCase::test_cli_seed tests/test_factory.py::FactoryTestCase::test_cli_seed_with_repeat tests/test_factory.py::FactoryTestCase::test_cli_verbosity tests/test_factory.py::FactoryTestCase::test_command tests/test_factory.py::FactoryTestCase::test_command_custom_provider tests/test_factory.py::FactoryTestCase::test_documentor tests/test_factory.py::FactoryTestCase::test_email tests/test_factory.py::FactoryTestCase::test_ext_word_list tests/test_factory.py::FactoryTestCase::test_format_calls_formatter_on_provider tests/test_factory.py::FactoryTestCase::test_format_transfers_arguments_to_formatter tests/test_factory.py::FactoryTestCase::test_get_formatter_returns_callable tests/test_factory.py::FactoryTestCase::test_get_formatter_returns_correct_formatter tests/test_factory.py::FactoryTestCase::test_get_formatter_throws_exception_on_incorrect_formatter tests/test_factory.py::FactoryTestCase::test_instance_seed_chain tests/test_factory.py::FactoryTestCase::test_invalid_locale tests/test_factory.py::FactoryTestCase::test_ipv4 tests/test_factory.py::FactoryTestCase::test_ipv4_network_class tests/test_factory.py::FactoryTestCase::test_ipv4_private tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_a tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_b tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_c tests/test_factory.py::FactoryTestCase::test_ipv4_public tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_a tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_b tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_c tests/test_factory.py::FactoryTestCase::test_ipv6 tests/test_factory.py::FactoryTestCase::test_language_code tests/test_factory.py::FactoryTestCase::test_locale tests/test_factory.py::FactoryTestCase::test_magic_call_calls_format tests/test_factory.py::FactoryTestCase::test_magic_call_calls_format_with_arguments tests/test_factory.py::FactoryTestCase::test_negative_pyfloat tests/test_factory.py::FactoryTestCase::test_nl_BE_ssn_valid tests/test_factory.py::FactoryTestCase::test_no_words tests/test_factory.py::FactoryTestCase::test_no_words_paragraph tests/test_factory.py::FactoryTestCase::test_no_words_sentence tests/test_factory.py::FactoryTestCase::test_parse_returns_same_string_when_it_contains_no_curly_braces tests/test_factory.py::FactoryTestCase::test_parse_returns_string_with_tokens_replaced_by_formatters tests/test_factory.py::FactoryTestCase::test_password tests/test_factory.py::FactoryTestCase::test_prefix_suffix_always_string tests/test_factory.py::FactoryTestCase::test_random_element tests/test_factory.py::FactoryTestCase::test_random_number tests/test_factory.py::FactoryTestCase::test_random_pyfloat tests/test_factory.py::FactoryTestCase::test_random_pystr_characters tests/test_factory.py::FactoryTestCase::test_random_sample_unique tests/test_factory.py::FactoryTestCase::test_slugify tests/test_factory.py::FactoryTestCase::test_some_words tests/test_factory.py::FactoryTestCase::test_texts_chars_count tests/test_factory.py::FactoryTestCase::test_texts_count tests/test_factory.py::FactoryTestCase::test_texts_word_list tests/test_factory.py::FactoryTestCase::test_unique_words tests/test_factory.py::FactoryTestCase::test_us_ssn_valid tests/test_factory.py::FactoryTestCase::test_words_ext_word_list tests/test_factory.py::FactoryTestCase::test_words_ext_word_list_unique tests/test_factory.py::FactoryTestCase::test_words_valueerror
faker/providers/python/__init__.py
faker/providers/python/__init__.py