Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on random number generator #643

Merged
merged 1 commit into from
Mar 12, 2018

Conversation

josesimoes
Copy link
Member

Description

  • Implement interface for hardware random generator in STM32 targets (strong implementation of existing weak random)

Motivation and Context

How Has This Been Tested?

  • System.Random app from samples repo

Output using newlib rand()

-- 10 random integers between 0 and 100 --
69
79
11
70
27
28
0
10
93
66

-- 10 random integers between 0 and 999999 --
971936
562964
469367
400275
808434
566033
951456
684178
926690
36534

-- 10 random doubles --
0.096457387831275068
0.98327366401593841
0.91643186235634233
0.53871225218228636
0.065404424474297285
0.23429514944287722
0.082870655266042176
0.80382189098923551
0.53989917903202544
0.81513274079893383

-- 10 random numbers from array --
57
99
38
46
93
236
158
199
104
183

Output using hardware random generator

-- 10 random integers between 0 and 100 --
60
99
90
24
44
33
4
25
12
69

-- 10 random integers between 0 and 999999 --
811207
695039
54885
100920
772318
844083
263480
587971
989447
613734

-- 10 random doubles --
0.12095915994629244
0.208135329002546
0.61765822410063309
0.84031696753583773
0.60034945970409304
0.98402133932896452
0.23056060965884492
0.77650020778563345
0.18943352419636994
0.64050802649941951

-- 10 random numbers from array --
112
1
125
153
188
69
98
23
44
146

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: josesimoes [email protected]

- Implement interface for hardware random generator in STM32 targets (strong implementation of existing weak random)
- Replace pseudo random generator with newlib nano rand() implementation
- Closes #123 & #124

Signed-off-by: josesimoes <[email protected]>
@josesimoes josesimoes added Type: enhancement Area: Interpreter Everything related with the interpreter, execution engine and such Area: Targets labels Mar 12, 2018
@nfbot
Copy link
Member

nfbot commented Mar 12, 2018

Hi @josesimoes,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

@josesimoes josesimoes merged commit 4683372 into nanoframework:develop Mar 12, 2018
@josesimoes josesimoes deleted the work-random-generator branch March 12, 2018 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Interpreter Everything related with the interpreter, execution engine and such Area: Targets Type: enhancement
Projects
None yet
2 participants