Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 24, 2024
1 parent 9dc75db commit 99dc87c
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 31 deletions.
2 changes: 1 addition & 1 deletion base/minstd-shuffle/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/random/base",
"@stdlib/random/base/shared",
"@stdlib/random/base/minstd"
]
}
Expand Down
2 changes: 1 addition & 1 deletion base/minstd/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/random/base"
"@stdlib/random/base/shared"
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion base/mt19937/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/random/base"
"@stdlib/random/base/shared"
]
}
]
Expand Down
2 changes: 0 additions & 2 deletions base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"benchmark": "./benchmark",
"doc": "./docs",
"example": "./examples",
"include": "./include",
"lib": "./lib",
"src": "./src",
"test": "./test"
},
"types": "./docs/types",
Expand Down
2 changes: 1 addition & 1 deletion base/randi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/random/base",
"@stdlib/random/base/shared",
"@stdlib/random/base/minstd",
"@stdlib/random/base/minstd-shuffle",
"@stdlib/random/base/mt19937"
Expand Down
2 changes: 1 addition & 1 deletion base/randu/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/random/base",
"@stdlib/random/base/shared",
"@stdlib/random/base/minstd",
"@stdlib/random/base/minstd-shuffle",
"@stdlib/random/base/mt19937"
Expand Down
157 changes: 157 additions & 0 deletions base/shared/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<!--
@license Apache-2.0
Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# shared

> Common APIs shared across base pseudorandom number generators.
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var headerDir = require( '@stdlib/random/base/shared' );
```

#### headerDir

Absolute file path for the directory containing header files for C APIs.

```javascript
var dir = headerDir;
// returns <string>
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

```javascript
var headerDir = require( '@stdlib/random/base/shared' );

console.log( headerDir );
// => <string>
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/random/base/shared.h"
```

#### TODO

TODO

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@
* limitations under the License.
*/

/**
* Benchmark `random.base`.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include "stdlib/random/base.h"
#include "stdlib/random/base/shared.h"

#define NAME "random/base"
#define NAME "random/base/shared"
#define ITERATIONS 1000000
#define REPEATS 3

Expand Down Expand Up @@ -168,7 +165,7 @@ static struct BasePRNGObject * mock_prng_allocate( const int32_t seed ) {
/**
* Prints the TAP version.
*/
void print_version() {
void print_version( void ) {
printf( "TAP version 13\n" );
}

Expand Down Expand Up @@ -206,7 +203,7 @@ void print_results( double elapsed ) {
*
* @return clock time
*/
double tic() {
double tic( void ) {
struct timeval now;
gettimeofday( &now, NULL );
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
Expand All @@ -217,7 +214,7 @@ double tic() {
*
* @return random double
*/
double rand_double() {
double rand_double( void ) {
int r = rand();
return (double)r / ( (double)RAND_MAX + 1.0 );
}
Expand All @@ -227,7 +224,7 @@ double rand_double() {
*
* @return elapsed time in seconds
*/
double benchmark1() {
double benchmark1( void ) {
double elapsed;
uint64_t v;
double t;
Expand Down Expand Up @@ -258,7 +255,7 @@ double benchmark1() {
*
* @return elapsed time in seconds
*/
double benchmark2() {
double benchmark2( void ) {
double elapsed;
double t;
double v;
Expand Down Expand Up @@ -289,7 +286,7 @@ double benchmark2() {
*
* @return elapsed time in seconds
*/
double benchmark3() {
double benchmark3( void ) {
double elapsed;
uint64_t v;
double t;
Expand Down Expand Up @@ -321,7 +318,7 @@ double benchmark3() {
*
* @return elapsed time in seconds
*/
double benchmark4() {
double benchmark4( void ) {
double elapsed;
uint64_t v;
double t;
Expand Down Expand Up @@ -353,7 +350,7 @@ double benchmark4() {
*
* @return elapsed time in seconds
*/
double benchmark5() {
double benchmark5( void ) {
double elapsed;
double v;
double t;
Expand Down Expand Up @@ -385,7 +382,7 @@ double benchmark5() {
*
* @return elapsed time in seconds
*/
double benchmark6() {
double benchmark6( void ) {
double elapsed;
double v;
double t;
Expand Down Expand Up @@ -417,7 +414,7 @@ double benchmark6() {
*
* @return elapsed time in seconds
*/
double benchmark7() {
double benchmark7( void ) {
double elapsed;
size_t v;
double t;
Expand Down Expand Up @@ -449,7 +446,7 @@ double benchmark7() {
*
* @return elapsed time in seconds
*/
double benchmark8() {
double benchmark8( void ) {
struct BasePRNGObject *out;
double elapsed;
double t;
Expand Down Expand Up @@ -484,7 +481,7 @@ double benchmark8() {
*
* @return elapsed time in seconds
*/
double benchmark9() {
double benchmark9( void ) {
double elapsed;
int8_t status;
double t;
Expand Down Expand Up @@ -523,7 +520,7 @@ double benchmark9() {
*
* @return elapsed time in seconds
*/
double benchmark10() {
double benchmark10( void ) {
double elapsed;
int8_t status;
double t;
Expand Down
33 changes: 33 additions & 0 deletions base/shared/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// TypeScript Version: 4.1

/**
* Absolute file path for the directory containing header files for C APIs.
*
* @example
* var dir = headerDir;
* // returns <string>
*/
declare const headerDir: string;


// EXPORTS //

export = headerDir;
Loading

0 comments on commit 99dc87c

Please sign in to comment.