Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
5542-Write-test-case-for-splitmix64_next.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5542-Write-test-case-for-splitmix64_next.patch of Package erlang
From f377ee36e6b84975372d4d9b92146ec0fd6d0fb5 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Wed, 30 Mar 2022 17:28:16 +0200 Subject: [PATCH 02/11] Write test case for splitmix64_next --- lib/stdlib/test/rand_SUITE.erl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/stdlib/test/rand_SUITE.erl b/lib/stdlib/test/rand_SUITE.erl index da721ca900..9eed862a66 100644 --- a/lib/stdlib/test/rand_SUITE.erl +++ b/lib/stdlib/test/rand_SUITE.erl @@ -35,7 +35,8 @@ all() -> [seed, interval_int, interval_float, bytes_count, api_eq, - mcg35_api, mcg35_rem, lcg35_api, exsp_next_api, exsp_jump_api, + mcg35_api, mcg35_rem, lcg35_api, + exsp_next_api, exsp_jump_api, splitmix64_next_api, reference, {group, basic_stats}, {group, distr_stats}, @@ -290,6 +291,22 @@ exsp_jump_api(State, AlgState, N) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Verify splitmix64_next behaviour +%% +splitmix64_next_api(Config) when is_list(Config) -> + splitmix64_next_api(55555555, 100000, 0). + +splitmix64_next_api(_State, 0, X) -> + X0 = 13069087632117122295, + {X0, X0} = {X, X0}, + ok; +splitmix64_next_api(AlgState, N, X) + when is_integer(X), 0 =< X, X < 1 bsl 64 -> + {X1, NewAlgState} = rand:splitmix64_next(AlgState), + splitmix64_next_api(NewAlgState, N - 1, X1). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %% Check that uniform/1 returns values within the proper interval. interval_int(Config) when is_list(Config) -> Algs = [default|algs()], -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor