Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6771337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:25:12+00:00 2026-05-26T15:25:12+00:00

i have these: a=sc.array([0,1]) b=sc.array([1,0]) c=sc.array([0,-1]) d=sc.array([-1,0]) orientation_list=(sc.array([a,b,c,d])).tolist() #——————————————————————— #i am trying sth like

  • 0

i have these:

    a=sc.array([0,1])
    b=sc.array([1,0])
    c=sc.array([0,-1])
    d=sc.array([-1,0])
    orientation_list=(sc.array([a,b,c,d])).tolist()
    #---------------------------------------------------------------------

    #i am trying sth like this
    tab=sc.random.random_integers(orientation_list)

I want the ‘tab’ to retrieve randomly one of the above arrays.For example ‘tab=[0,1]’
Is there a way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:25:12+00:00Added an answer on May 26, 2026 at 3:25 pm
    >>> import random
    >>> tab = random.choice([[0, 1], [1, 0], [0, -1], [-1, 0]])
    >>> tab
    [-1, 0]
    

    Your code creates a bunch of NumPy arrays, then a list of these NumPy arrays, then transforms this list itself into a NumPy array and finally transforms everything back to a list. The code above skips all those (rather pointless) conversions and uses Python’s built-in random module instead of NumPy’s numpy.random.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these strings in an array and I want to iterate this array
I have an array of integers like these; dim x as integer()={10,9,4,7,6,8,3}. Now I
I have an array with 16 elements. I would like to evaluate these to
I have an array like this: object[] args and need to insert those args
I have got an array full with items like these: array( array( 'id' =>
So basically I have these two arrays I want to merge... array(1) { [first]=>
I am trying to return mime types from an array. I have these strings
I am trying to create a pacman-like game. I have an array that looks
I have these two arrays. I want array b to be merged into array
I want to store an array of latitudes/longitudes. I have these inputs on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.