Skip to content

Commit

Permalink
Merge ceafb26 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 15, 2021
2 parents 9c0faba + ceafb26 commit 51e8a3d
Show file tree
Hide file tree
Showing 36 changed files with 9,776 additions and 1,321 deletions.
12 changes: 12 additions & 0 deletions .github/patch_readme_for_pubdev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e


# Patching 'README.md' for PubDev instead of GitHub
# removing everything before "\n# ", the first header
cp README.md README.md.bak
readme_text=$(cat README.md | tr '\n' '\r')
readme_text=$(echo "$readme_text" | perl -p0e 's|^.*?\r# |# \1|')
readme_text=$(echo "$readme_text" | tr '\r' '\n')
echo "$readme_text" > README.md

cat README.md
142 changes: 142 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# https://github.com/dart-lang/setup-dart

name: unittest

on:
push:
branches: [dev]
paths-ignore:
- 'example/*'
- '**.md'
- '**.txt'

pull_request:
branches: [dev]
paths-ignore:
- 'example/*'
- '**.md'
- '**.txt'

jobs:
test:
timeout-minutes: 9
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest] # [ubuntu-latest, macos-latest, windows-latest]
sdk: [2.12.0] # dart is null-safe since 2.12
platform: [node, vm, chrome]
#sdk: [stable, beta, dev, 2.12.0-29.10.beta]
steps:
- uses: actions/checkout@v2
# - uses: actions/setup-node@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: Install dependencies
run: dart pub get

# - name: VM tests
# run: dart test

- name: Tests
run: dart test --platform ${{ matrix.platform }}


analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: 2.12.0
- name: Install dependencies
run: dart pub get
- name: Analyze
run: dart analyze lib --fatal-infos
- name: Publish (dry run)
run: dart pub publish --dry-run

merge-to-staging:
needs: [test, analyze]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge current -> master
uses: devmasx/[email protected]
with:
type: now
target_branch: staging
github_token: ${{ github.token }}


to-master:
if: github.event.head_commit.message=='publish'
needs: [test, analyze]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# UPDATE MASTER BRANCH

- name: Merge to master branch
uses: devmasx/[email protected]
with:
type: now
target_branch: master
github_token: ${{ github.token }}

# ADD GITHUB RELEASE

- name: Get version from pubspec.yaml
run: echo "PKGVER=$(sed -n "s/version://p" pubspec.yaml | xargs)" >> $GITHUB_ENV
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.PKGVER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

to-pubdev:
needs: to-master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Setup PubDev credentials
# data from cat ~/.pub-cache/credentials.json
run: |
mkdir -p ~/.pub-cache
cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"${{ secrets.PUBDEV_ACCESS_TOKEN }}",
"refreshToken":"${{ secrets.PUBDEV_REFRESH_TOKEN }}",
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
"expiration": 1570721159347
}
EOF
- name: Patching 'README.md' for PubDev instead of GitHub
run:
.github/patch_readme_for_pubdev.sh

- name: Install dependencies
run: dart pub get

- name: Reformat code
run: dart format .

- name: Analyze reformatted
run: dart analyze --fatal-infos

- name: Unit-tests for reformatted code
run: dart test

- name: Publish package
run:
#pub publish --dry-run
pub publish -f

45 changes: 0 additions & 45 deletions .github/workflows/unittest.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test/
todo.txt
.github
README.md.bak
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.7.0

- Added Xoshiro256**

- fixed: for 64-bit generators `.nextInt32` was throwing an assertion error
instead of returning 0 as a random result

# 0.6.4+2

- Updated documentation
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Library priorities:

----------

It has the same API as the standard [`Random`](https://api.dart.dev/stable/2.12.1/dart-math/Random-class.html)
It has the same API as the standard
[`Random`](https://api.dart.dev/stable/2.12.1/dart-math/Random-class.html)

``` dart
import 'package:xrandom/xrandom.dart';
Expand All @@ -33,7 +34,8 @@ var unordered = [1, 2, 3, 4, 5]..shuffle(random);

# Creating the object

The library provides classes that differ in the first letter: `Xrandom`, `Qrandom`, `Drandom`.
The library provides classes that differ in the first letter: `Xrandom`,
`Qrandom`, `Drandom`.

If you just want a random number:

Expand Down Expand Up @@ -120,10 +122,12 @@ Sorted by `nextDouble` **fastest to slowest**

## nextRaw

These methods return the raw output of the generator uncompromisingly fast. Depending on the algorithm,
the output is a number consisting of either 32 random bits or 64 random bits.
These methods return the raw output of the generator uncompromisingly fast.
Depending on the algorithm, the output is a number consisting of either 32
random bits or 64 random bits.

Xrandom combines small integers or splits large ones. The methods work with any of the generators.
Xrandom combines small integers or splits large ones. The methods work with any
of the generators.


| JS | Method | Returns | Equivalent of |
Expand Down Expand Up @@ -173,6 +177,7 @@ only comparison to `nextRaw32` is "apples-to-apples".
|| | `Xorshift128p` | [xorshift128+ v2](https://arxiv.org/abs/1404.0390) | 2015 |
|| | `Mulberry32` | [mulberry32](https://git.io/JmoUq) | 2017 |
||| `Xoshiro128pp` | [xoshiro128++ 1.0](https://prng.di.unimi.it/xoshiro128plusplus.c) | 2019 | `Qrandom`, `Drandom` |
|| | `Xoshiro256ss` | [xoshiro256** 1.0](https://xoshiro.di.unimi.it/xoshiro256starstar.c) | 2018 | |
|| | `Xoshiro256pp` | [xoshiro256++ 1.0](https://prng.di.unimi.it/xoshiro256plusplus.c) | 2019 | |


Expand Down
9 changes: 0 additions & 9 deletions benchmark/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions benchmark/analysis_options.yaml

This file was deleted.

Loading

0 comments on commit 51e8a3d

Please sign in to comment.