Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:33 14 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 Random Number Test

Author Message
Imgonna

Newbie

Joined: 06/08/2020
Location: United Kingdom
Posts: 15
Posted: 02:17pm 10 Aug 2020
Copy link to clipboard 
Print this post

A sweaty afternoon all (well here in the Wales / UK it's a sweaty 27'C)

Getting hands on with CMM2 and loving it.

I also love math and random numbers --- about to code up / benchmark some performance in calculating/estimating PI, so I need some reliable random numbers.

I know the CMM2 generates random numbers through hardware -- does anyone know the specifics of this?  (Just for geeky reference really).

Currently iterating through generating 10,000,000 random numbers having started with 100,1000 etc.  (generating 0 / 1 to simulate coin flipping)

Looking at the numbers generated via ChiSquared statistics - to see if they random - results in p=0.898 --> ie random (as we would expect).

Below is the code for 10,000,000 interations.

I wonder how warm the CPU will get -- BTW loved the case mode for a fan also posted here.

StartTime$ = "Start Time: "+ Time$


dim anum(2)

for y = 1 to 1
anum(0)=0
anum(1)=0

For x = 1 to 10000000
 
 num=int((rnd)*2)
 select case num
   case 0
     anum(0)=anum(0)+1
   case 1
     anum(1) = anum(1)+1
 end select

if x mod 10000 = 0 then
 CLS
 Print StartTime$
 Print ""
 print "Iteration", format$(x,"%.0f")

endif

next x

Print ""
print format$(anum(0),"%.0f"),format$(anum(1),"%.0f")
next y

Print ""
Print "End Time: "+ Time$

Edited 2020-08-11 00:24 by Imgonna
 
Imgonna

Newbie

Joined: 06/08/2020
Location: United Kingdom
Posts: 15
Posted: 02:33pm 10 Aug 2020
Copy link to clipboard 
Print this post

Hi

For what it's worth - 10,000,000 iterations took 5 mins 31sec.

Glen
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 734
Posted: 03:03pm 10 Aug 2020
Copy link to clipboard 
Print this post

I'm curious about a ' hardware '
random number generator ?
A zener diode with counter ?
Edited 2020-08-11 01:12 by hitsware2
my site
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 03:28pm 10 Aug 2020
Copy link to clipboard 
Print this post

The onboard random generator is in the silicon (and thus hardware).

If, however, you wanna play with something you can "scope", this might be interesting http://www.fruitoftheshed.com/Circuit%20Ideas.Random-Bit-Generator-for-cryptographic-strength-random-numbers.ashx
Edited 2020-08-11 02:54 by CaptainBoing
 
Imgonna

Newbie

Joined: 06/08/2020
Location: United Kingdom
Posts: 15
Posted: 03:32pm 10 Aug 2020
Copy link to clipboard 
Print this post

  CaptainBoing said  The onboard randome generator is in the silicon (and thus hardware).

If, however, you wanna play with something you can "scope", this might be interesting http://www.fruitoftheshed.com/Circuit%20Ideas.Random-Bit-Generator-for-cryptographic-strength-random-numbers.ashx


A quick Google of STM32 ARM  and the spec sheet mentions "coupled oscillators" -- happy with that.

Thanks for the link.

Glen
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 11:16am 11 Aug 2020
Copy link to clipboard 
Print this post

  Imgonna said  I wonder how warm the CPU will get

The CPU keeps a constant speed regardless of what code it is executing or even if it is at the command prompt.  So it will not heat up under heavy processing.

Geoff
Geoff Graham - http://geoffg.net
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 425
Posted: 11:57am 11 Aug 2020
Copy link to clipboard 
Print this post

  Geoffg said  
  Imgonna said  I wonder how warm the CPU will get

The CPU keeps a constant speed regardless of what code it is executing or even if it is at the command prompt.  So it will not heat up under heavy processing.

Geoff


Nice - my hacky logger has been recording for 18hrs now  -- so no need to consider this.

So, summer project is to make a hacky weather station......

Nim
Entropy is not what it used to be
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025