Skip to content

Commit

Permalink
refactor: random number generation in examples
Browse files Browse the repository at this point in the history
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: passed
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: passed
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
anandkaranubc committed Feb 19, 2025
1 parent 4f85774 commit e48bac5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,17 @@ y = myquantile( 1.0 );
<!-- eslint no-undef: "error" -->

```javascript
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/array/uniform' );
var quantile = require( '@stdlib/stats/base/dists/bradford/quantile' );

var p;
var c;
var p = uniform( 10, 0.0, 1.0 );
var c = uniform( 10, 0.1, 10.0 );

var y;
var i;

for ( i = 0; i < 10; i++ ) {
p = randu();
c = ( randu()*10.0 );
y = quantile( p, c );
console.log( 'p: %d, c: %d, Q(p;c): %d', p.toFixed( 4 ), c.toFixed( 4 ), y.toFixed( 4 ) );
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[ i ], c[ i ] );
console.log( 'p: %d, c: %d, Q(p;c): %d', p[ i ].toFixed( 4 ), c[ i ].toFixed( 4 ), y.toFixed( 4 ) );
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@

'use strict';

var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/array/uniform' );
var quantile = require( './../lib' );

var p;
var c;
var p = uniform( 10, 0.0, 1.0 );
var c = uniform( 10, 0.1, 10.0 );

var y;
var i;

for ( i = 0; i < 10; i++ ) {
p = randu();
c = ( randu()*10.0 );
y = quantile( p, c );
console.log( 'p: %d, c: %d, Q(p;c): %d', p.toFixed( 4 ), c.toFixed( 4 ), y.toFixed( 4 ) );
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[ i ], c[ i ] );
console.log( 'p: %d, c: %d, Q(p;c): %d', p[ i ].toFixed( 4 ), c[ i ].toFixed( 4 ), y.toFixed( 4 ) );
}

0 comments on commit e48bac5

Please sign in to comment.